Skip to content

Commit 0d0263e

Browse files
authored
Rollup merge of rust-lang#146194 - bend-n:fix-path-str-eq, r=ibraheemdev
fix path str eq fixes rust-lang#146183 where the impl for partialeq<str> for pathbuf resulted in infinite recursion
2 parents 4ac655b + 1fb026c commit 0d0263e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

std/src/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2107,7 +2107,7 @@ impl PartialEq for PathBuf {
21072107
impl cmp::PartialEq<str> for PathBuf {
21082108
#[inline]
21092109
fn eq(&self, other: &str) -> bool {
2110-
&*self == other
2110+
Path::eq(self, other)
21112111
}
21122112
}
21132113

std/tests/path.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2526,3 +2526,9 @@ fn normalize_lexically() {
25262526
check_err(r"\\?\UNC\server\share\a\..\..");
25272527
}
25282528
}
2529+
2530+
#[test]
2531+
/// See issue#146183
2532+
fn compare_path_to_str() {
2533+
assert!(&PathBuf::from("x") == "x");
2534+
}

0 commit comments

Comments
 (0)