about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-09-24 23:33:28 +0200
committerGitHub <noreply@github.com>2025-09-24 23:33:28 +0200
commitd10d6bfb02de77c472de7906e58b77e94d35c058 (patch)
tree0318af3f6a173f2ab9350e68a8dac8bd9378ebbb /library/std/src
parent6618ac7bb1caff5b1abe4795101f5c5f17603340 (diff)
parent5a4e53603631475335bab3e1416f4aca61172094 (diff)
downloadrust-d10d6bfb02de77c472de7906e58b77e94d35c058.tar.gz
rust-d10d6bfb02de77c472de7906e58b77e94d35c058.zip
Rollup merge of #146958 - el-ev:fix_path_string_eq_recurse, r=joboet
Fix infinite recursion in Path::eq with String

- Closes [after beta backport] rust-lang/rust#146940
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/path.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 70ba502d684..88d8a4f21ca 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 {
-        Path::eq(self, other)
+        self.as_path() == other
     }
 }
 
@@ -2115,7 +2115,7 @@ impl cmp::PartialEq<str> for PathBuf {
 impl cmp::PartialEq<PathBuf> for str {
     #[inline]
     fn eq(&self, other: &PathBuf) -> bool {
-        other == self
+        self == other.as_path()
     }
 }
 
@@ -2123,7 +2123,7 @@ impl cmp::PartialEq<PathBuf> for str {
 impl cmp::PartialEq<String> for PathBuf {
     #[inline]
     fn eq(&self, other: &String) -> bool {
-        **self == **other
+        self.as_path() == other.as_str()
     }
 }
 
@@ -2131,7 +2131,7 @@ impl cmp::PartialEq<String> for PathBuf {
 impl cmp::PartialEq<PathBuf> for String {
     #[inline]
     fn eq(&self, other: &PathBuf) -> bool {
-        other == self
+        self.as_str() == other.as_path()
     }
 }
 
@@ -3426,7 +3426,7 @@ impl cmp::PartialEq<Path> for str {
 impl cmp::PartialEq<String> for Path {
     #[inline]
     fn eq(&self, other: &String) -> bool {
-        self == &*other
+        self == other.as_str()
     }
 }
 
@@ -3434,7 +3434,7 @@ impl cmp::PartialEq<String> for Path {
 impl cmp::PartialEq<Path> for String {
     #[inline]
     fn eq(&self, other: &Path) -> bool {
-        other == self
+        self.as_str() == other
     }
 }