diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-09-24 23:33:28 +0200 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-24 23:33:28 +0200 | 
| commit | d10d6bfb02de77c472de7906e58b77e94d35c058 (patch) | |
| tree | 0318af3f6a173f2ab9350e68a8dac8bd9378ebbb /library/std/tests/path.rs | |
| parent | 6618ac7bb1caff5b1abe4795101f5c5f17603340 (diff) | |
| parent | 5a4e53603631475335bab3e1416f4aca61172094 (diff) | |
| download | rust-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/tests/path.rs')
| -rw-r--r-- | library/std/tests/path.rs | 16 | 
1 files changed, 13 insertions, 3 deletions
| diff --git a/library/std/tests/path.rs b/library/std/tests/path.rs index fa76c50597b..837a14b808f 100644 --- a/library/std/tests/path.rs +++ b/library/std/tests/path.rs @@ -2528,7 +2528,17 @@ fn normalize_lexically() { } #[test] -/// See issue#146183 -fn compare_path_to_str() { - assert!(&PathBuf::from("x") == "x"); +/// See issue#146183 and issue#146940 +fn compare_path_like_to_str_like() { + let path_buf = PathBuf::from("x"); + let path = Path::new("x"); + let s = String::from("x"); + assert!(path == "x"); + assert!("x" == path); + assert!(path == &s); + assert!(&s == path); + assert!(&path_buf == "x"); + assert!("x" == &path_buf); + assert!(path_buf == s); + assert!(s == path_buf); } | 
