about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/std/src/path.rs2
-rw-r--r--library/std/tests/path.rs6
2 files changed, 7 insertions, 1 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 531a1aa4215..19663e4a9df 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -2107,7 +2107,7 @@ impl PartialEq for PathBuf {
 impl cmp::PartialEq<str> for PathBuf {
     #[inline]
     fn eq(&self, other: &str) -> bool {
-        &*self == other
+        Path::eq(self, other)
     }
 }
 
diff --git a/library/std/tests/path.rs b/library/std/tests/path.rs
index 3577f0d9c7b..fa76c50597b 100644
--- a/library/std/tests/path.rs
+++ b/library/std/tests/path.rs
@@ -2526,3 +2526,9 @@ fn normalize_lexically() {
         check_err(r"\\?\UNC\server\share\a\..\..");
     }
 }
+
+#[test]
+/// See issue#146183
+fn compare_path_to_str() {
+    assert!(&PathBuf::from("x") == "x");
+}