Skip to content

Commit

Permalink
Bless new test output (new trait impls in lists of suggestions)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtriplett committed Jan 4, 2025
1 parent 177ad2b commit 4af44ae
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 25 deletions.
2 changes: 1 addition & 1 deletion tests/ui/array-slice-vec/slice-to-vec-comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ fn main() {
let a = &[];
let b: &Vec<u8> = &vec![];
a > b;
//~^ ERROR mismatched types
//~^ ERROR can't compare `[_; 0]` with `Vec<u8>`
}
22 changes: 16 additions & 6 deletions tests/ui/array-slice-vec/slice-to-vec-comparison.stderr
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
error[E0308]: mismatched types
--> $DIR/slice-to-vec-comparison.rs:4:9
error[E0277]: can't compare `[_; 0]` with `Vec<u8>`
--> $DIR/slice-to-vec-comparison.rs:4:7
|
LL | a > b;
| ^ expected `&[_; 0]`, found `&Vec<u8>`
| ^ no implementation for `[_; 0] < Vec<u8>` and `[_; 0] > Vec<u8>`
|
= note: expected reference `&[_; 0]`
found reference `&Vec<u8>`
= help: the trait `PartialOrd<Vec<u8>>` is not implemented for `[_; 0]`
= help: the following other types implement trait `PartialOrd<Rhs>`:
`&[u8; N]` implements `PartialOrd<ByteStr>`
`&[u8; N]` implements `PartialOrd<ByteString>`
`&[u8]` implements `PartialOrd<ByteStr>`
`&[u8]` implements `PartialOrd<ByteString>`
`[T; N]` implements `PartialOrd`
`[T]` implements `PartialOrd`
`[u8; N]` implements `PartialOrd<ByteStr>`
`[u8; N]` implements `PartialOrd<ByteString>`
and 2 others
= note: required for `&[_; 0]` to implement `PartialOrd<&Vec<u8>>`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0308`.
For more information about this error, try `rustc --explain E0277`.
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ help: use fully-qualified syntax
|
LL | type X = <ByteStr as Deref>::Target;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | type X = <ByteString as Deref>::Target;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | type X = <CString as Deref>::Target;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | type X = <IoSlice<'_> as Deref>::Target;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | type X = <IoSliceMut<'_> as Deref>::Target;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and N other candidates

error: aborting due to 5 previous errors
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/consts/too_generic_eval_ice.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ LL | [5; Self::HOST_SIZE] == [6; 0]
= help: the following other types implement trait `PartialEq<Rhs>`:
`&[T]` implements `PartialEq<Vec<U, A>>`
`&[T]` implements `PartialEq<[U; N]>`
`&[u8; N]` implements `PartialEq<ByteStr>`
`&[u8; N]` implements `PartialEq<ByteString>`
`&[u8]` implements `PartialEq<ByteStr>`
`&[u8]` implements `PartialEq<ByteString>`
`&mut [T]` implements `PartialEq<Vec<U, A>>`
`&mut [T]` implements `PartialEq<[U; N]>`
`[T; N]` implements `PartialEq<&[U]>`
`[T; N]` implements `PartialEq<&mut [U]>`
`[T; N]` implements `PartialEq<[U; N]>`
`[T; N]` implements `PartialEq<[U]>`
and 3 others
and 11 others

error: aborting due to 4 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ error[E0277]: the trait bound `String: Borrow<&str>` is not satisfied
LL | &s
| ^^ the trait `Borrow<&str>` is not implemented for `String`
|
= help: the trait `Borrow<&_>` is not implemented for `String`
but trait `Borrow<_>` is implemented for it
= help: for that trait implementation, expected `str`, found `&str`
= help: the following other types implement trait `Borrow<Borrowed>`:
`String` implements `Borrow<ByteStr>`
`String` implements `Borrow<str>`
= note: required for `HashMap<String, String>` to implement `Index<&&str>`

error: aborting due to 1 previous error
Expand Down
1 change: 1 addition & 0 deletions tests/ui/inference/issue-71732.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ LL | .get(&"key".into())
| cannot infer type of the type parameter `Q` declared on the method `get`
|
= note: multiple `impl`s satisfying `String: Borrow<_>` found in the following crates: `alloc`, `core`:
- impl Borrow<ByteStr> for String;
- impl Borrow<str> for String;
- impl<T> Borrow<T> for T
where T: ?Sized;
Expand Down
13 changes: 8 additions & 5 deletions tests/ui/inference/issue-72616.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ LL | if String::from("a") == "a".try_into().unwrap() {}
| |
| type must be known at this point
|
= note: multiple `impl`s satisfying `String: PartialEq<_>` found in the `alloc` crate:
- impl PartialEq for String;
- impl<'a, 'b> PartialEq<&'a str> for String;
- impl<'a, 'b> PartialEq<Cow<'a, str>> for String;
- impl<'a, 'b> PartialEq<str> for String;
= 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`
help: try using a fully qualified path to specify the expected types
|
LL | if String::from("a") == <&str as TryInto<T>>::try_into("a").unwrap() {}
Expand Down
9 changes: 9 additions & 0 deletions tests/ui/inference/issue-72690.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ LL | String::from("x".as_ref());
| ^^^^^^
|
= note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`:
- impl AsRef<ByteStr> for str;
- impl AsRef<OsStr> for str;
- impl AsRef<Path> for str;
- impl AsRef<[u8]> for str;
Expand All @@ -41,6 +42,7 @@ LL | |x| String::from("x".as_ref());
| ^^^^^^
|
= note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`:
- impl AsRef<ByteStr> for str;
- impl AsRef<OsStr> for str;
- impl AsRef<Path> for str;
- impl AsRef<[u8]> for str;
Expand All @@ -57,6 +59,7 @@ LL | let _ = "x".as_ref();
| ^ ------ type must be known at this point
|
= note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`:
- impl AsRef<ByteStr> for str;
- impl AsRef<OsStr> for str;
- impl AsRef<Path> for str;
- impl AsRef<[u8]> for str;
Expand All @@ -83,6 +86,7 @@ LL | String::from("x".as_ref());
| ^^^^^^
|
= note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`:
- impl AsRef<ByteStr> for str;
- impl AsRef<OsStr> for str;
- impl AsRef<Path> for str;
- impl AsRef<[u8]> for str;
Expand All @@ -109,6 +113,7 @@ LL | String::from("x".as_ref());
| ^^^^^^
|
= note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`:
- impl AsRef<ByteStr> for str;
- impl AsRef<OsStr> for str;
- impl AsRef<Path> for str;
- impl AsRef<[u8]> for str;
Expand All @@ -135,6 +140,7 @@ LL | String::from("x".as_ref());
| ^^^^^^
|
= note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`:
- impl AsRef<ByteStr> for str;
- impl AsRef<OsStr> for str;
- impl AsRef<Path> for str;
- impl AsRef<[u8]> for str;
Expand All @@ -161,6 +167,7 @@ LL | String::from("x".as_ref());
| ^^^^^^
|
= note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`:
- impl AsRef<ByteStr> for str;
- impl AsRef<OsStr> for str;
- impl AsRef<Path> for str;
- impl AsRef<[u8]> for str;
Expand All @@ -187,6 +194,7 @@ LL | String::from("x".as_ref());
| ^^^^^^
|
= note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`:
- impl AsRef<ByteStr> for str;
- impl AsRef<OsStr> for str;
- impl AsRef<Path> for str;
- impl AsRef<[u8]> for str;
Expand All @@ -213,6 +221,7 @@ LL | String::from("x".as_ref());
| ^^^^^^
|
= note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`:
- impl AsRef<ByteStr> for str;
- impl AsRef<OsStr> for str;
- impl AsRef<Path> for str;
- impl AsRef<[u8]> for str;
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/suggestions/issue-71394-no-from-impl.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ LL | let _: &[i8] = data.into();
| ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]`
|
= help: the following other types implement trait `From<T>`:
`&[u8]` implements `From<&ByteStr>`
`&mut [u8]` implements `From<&mut ByteStr>`
`[T; 10]` implements `From<(T, T, T, T, T, T, T, T, T, T)>`
`[T; 11]` implements `From<(T, T, T, T, T, T, T, T, T, T, T)>`
`[T; 12]` implements `From<(T, T, T, T, T, T, T, T, T, T, T, T)>`
`[T; 1]` implements `From<(T,)>`
`[T; 2]` implements `From<(T, T)>`
`[T; 3]` implements `From<(T, T, T)>`
`[T; 4]` implements `From<(T, T, T, T)>`
`[T; 5]` implements `From<(T, T, T, T, T)>`
and 6 others
and 8 others
= note: required for `&[u8]` to implement `Into<&[i8]>`

error: aborting due to 1 previous error
Expand Down
1 change: 1 addition & 0 deletions tests/ui/traits/issue-77982.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ LL | opts.get(opt.as_ref());
| cannot infer type of the type parameter `Q` declared on the method `get`
|
= note: multiple `impl`s satisfying `String: Borrow<_>` found in the following crates: `alloc`, `core`:
- impl Borrow<ByteStr> for String;
- impl Borrow<str> for String;
- impl<T> Borrow<T> for T
where T: ?Sized;
Expand Down

0 comments on commit 4af44ae

Please sign in to comment.