diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-08-19 14:18:14 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-19 14:18:14 +1000 |
| commit | 2beb54c451426f8f74c66d4587fcb331f14416f8 (patch) | |
| tree | ceace1bdf3de0f26e54c45696d7ab63701c7302f /tests | |
| parent | b96868fa2ef174b0a5aeb3bf041b3a5b517f11f8 (diff) | |
| parent | aab1563d42ed7cf54b017ad414f95fa45526f566 (diff) | |
| download | rust-2beb54c451426f8f74c66d4587fcb331f14416f8.tar.gz rust-2beb54c451426f8f74c66d4587fcb331f14416f8.zip | |
Rollup merge of #140956 - Kixunil:impl-partialeq-str-for-path, r=Amanieu
`impl PartialEq<{str,String}> for {Path,PathBuf}`
This is a revival of #105877
Comparison of paths and strings is expected to be possible and needed e.g. in tests. This change adds the impls os `PartialEq` between strings and paths, both owned and unsized, in both directions.
ACP: https://github.com/rust-lang/libs-team/issues/151
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/inference/issue-72616.stderr | 12 | ||||
| -rw-r--r-- | tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/tests/ui/inference/issue-72616.stderr b/tests/ui/inference/issue-72616.stderr index 31a0586301d..a271639996f 100644 --- a/tests/ui/inference/issue-72616.stderr +++ b/tests/ui/inference/issue-72616.stderr @@ -6,14 +6,10 @@ LL | if String::from("a") == "a".try_into().unwrap() {} | | | type must be known at this point | - = note: cannot satisfy `String: PartialEq<_>` - = help: the following types implement trait `PartialEq<Rhs>`: - `String` implements `PartialEq<&str>` - `String` implements `PartialEq<ByteStr>` - `String` implements `PartialEq<ByteString>` - `String` implements `PartialEq<Cow<'_, str>>` - `String` implements `PartialEq<str>` - `String` implements `PartialEq` + = note: multiple `impl`s satisfying `String: PartialEq<_>` found in the following crates: `alloc`, `std`: + - impl PartialEq for String; + - impl PartialEq<Path> for String; + - impl PartialEq<PathBuf> for String; help: try using a fully qualified path to specify the expected types | LL - if String::from("a") == "a".try_into().unwrap() {} diff --git a/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr b/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr index ebe103ef19a..c5984f53f68 100644 --- a/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr +++ b/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.stderr @@ -10,6 +10,8 @@ LL | String::from("Girls Band Cry") == T(String::from("Girls Band Cry")); `String` implements `PartialEq<ByteStr>` `String` implements `PartialEq<ByteString>` `String` implements `PartialEq<Cow<'_, str>>` + `String` implements `PartialEq<Path>` + `String` implements `PartialEq<PathBuf>` `String` implements `PartialEq<str>` `String` implements `PartialEq` = note: `T` implements `PartialEq<String>` |
