Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spell out other trait diagnostic #126127

Merged
merged 1 commit into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2064,7 +2064,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
if all_traits_equal {
format!("\n {}", c.self_ty())
} else {
format!("\n {c}")
format!("\n `{}` implements `{}`", c.self_ty(), c.print_only_trait_path())
}
})
.collect();
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/binop/binary-op-suggest-deref.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,10 @@ LL | let _ = FOO & (*"Sized".to_string().into_boxed_str());
|
= help: the trait `BitAnd<str>` is not implemented for `i32`
= help: the following other types implement trait `BitAnd<Rhs>`:
<&'a i32 as BitAnd<i32>>
<&i32 as BitAnd<&i32>>
<i32 as BitAnd<&i32>>
<i32 as BitAnd>
`&'a i32` implements `BitAnd<i32>`
`&i32` implements `BitAnd<&i32>`
`i32` implements `BitAnd<&i32>`
`i32` implements `BitAnd`

error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/binary-op-suggest-deref.rs:78:17
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/binop/binop-mul-i32-f32.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ LL | x * y
|
= help: the trait `Mul<f32>` is not implemented for `i32`
= help: the following other types implement trait `Mul<Rhs>`:
<&'a i32 as Mul<i32>>
<&i32 as Mul<&i32>>
<i32 as Mul<&i32>>
<i32 as Mul>
`&'a i32` implements `Mul<i32>`
`&i32` implements `Mul<&i32>`
`i32` implements `Mul<&i32>`
`i32` implements `Mul`

error: aborting due to 1 previous error

Expand Down
48 changes: 24 additions & 24 deletions tests/ui/binop/shift-various-bad-types.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ LL | 22 >> p.char;
|
= help: the trait `Shr<char>` is not implemented for `{integer}`
= help: the following other types implement trait `Shr<Rhs>`:
<&'a i128 as Shr<i128>>
<&'a i128 as Shr<i16>>
<&'a i128 as Shr<i32>>
<&'a i128 as Shr<i64>>
<&'a i128 as Shr<i8>>
<&'a i128 as Shr<isize>>
<&'a i128 as Shr<u128>>
<&'a i128 as Shr<u16>>
`&'a i128` implements `Shr<i128>`
`&'a i128` implements `Shr<i16>`
`&'a i128` implements `Shr<i32>`
`&'a i128` implements `Shr<i64>`
`&'a i128` implements `Shr<i8>`
`&'a i128` implements `Shr<isize>`
`&'a i128` implements `Shr<u128>`
`&'a i128` implements `Shr<u16>`
and 568 others

error[E0277]: no implementation for `{integer} >> &str`
Expand All @@ -24,14 +24,14 @@ LL | 22 >> p.str;
|
= help: the trait `Shr<&str>` is not implemented for `{integer}`
= help: the following other types implement trait `Shr<Rhs>`:
<&'a i128 as Shr<i128>>
<&'a i128 as Shr<i16>>
<&'a i128 as Shr<i32>>
<&'a i128 as Shr<i64>>
<&'a i128 as Shr<i8>>
<&'a i128 as Shr<isize>>
<&'a i128 as Shr<u128>>
<&'a i128 as Shr<u16>>
`&'a i128` implements `Shr<i128>`
`&'a i128` implements `Shr<i16>`
`&'a i128` implements `Shr<i32>`
`&'a i128` implements `Shr<i64>`
`&'a i128` implements `Shr<i8>`
`&'a i128` implements `Shr<isize>`
`&'a i128` implements `Shr<u128>`
`&'a i128` implements `Shr<u16>`
and 568 others

error[E0277]: no implementation for `{integer} >> &Panolpy`
Expand All @@ -42,14 +42,14 @@ LL | 22 >> p;
|
= help: the trait `Shr<&Panolpy>` is not implemented for `{integer}`
= help: the following other types implement trait `Shr<Rhs>`:
<&'a i128 as Shr<i128>>
<&'a i128 as Shr<i16>>
<&'a i128 as Shr<i32>>
<&'a i128 as Shr<i64>>
<&'a i128 as Shr<i8>>
<&'a i128 as Shr<isize>>
<&'a i128 as Shr<u128>>
<&'a i128 as Shr<u16>>
`&'a i128` implements `Shr<i128>`
`&'a i128` implements `Shr<i16>`
`&'a i128` implements `Shr<i32>`
`&'a i128` implements `Shr<i64>`
`&'a i128` implements `Shr<i8>`
`&'a i128` implements `Shr<isize>`
`&'a i128` implements `Shr<u128>`
`&'a i128` implements `Shr<u16>`
and 568 others

error[E0308]: mismatched types
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/const-generics/exhaustive-value.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ LL | <() as Foo<N>>::test()
| ^^ the trait `Foo<N>` is not implemented for `()`
|
= help: the following other types implement trait `Foo<N>`:
<() as Foo<0>>
<() as Foo<100>>
<() as Foo<101>>
<() as Foo<102>>
<() as Foo<103>>
<() as Foo<104>>
<() as Foo<105>>
<() as Foo<106>>
`()` implements `Foo<0>`
`()` implements `Foo<100>`
`()` implements `Foo<101>`
`()` implements `Foo<102>`
`()` implements `Foo<103>`
`()` implements `Foo<104>`
`()` implements `Foo<105>`
`()` implements `Foo<106>`
and 248 others

error: aborting due to 1 previous error
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/consts/const-eval/const-eval-overflow-3b.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ LL | = [0; (i8::MAX + 1u8) as usize];
|
= help: the trait `Add<u8>` is not implemented for `i8`
= help: the following other types implement trait `Add<Rhs>`:
<&'a i8 as Add<i8>>
<&i8 as Add<&i8>>
<i8 as Add<&i8>>
<i8 as Add>
`&'a i8` implements `Add<i8>`
`&i8` implements `Add<&i8>`
`i8` implements `Add<&i8>`
`i8` implements `Add`

error: aborting due to 2 previous errors

Expand Down
8 changes: 4 additions & 4 deletions tests/ui/consts/const-eval/const-eval-overflow-4b.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
|
= help: the trait `Add<u8>` is not implemented for `i8`
= help: the following other types implement trait `Add<Rhs>`:
<&'a i8 as Add<i8>>
<&i8 as Add<&i8>>
<i8 as Add<&i8>>
<i8 as Add>
`&'a i8` implements `Add<i8>`
`&i8` implements `Add<&i8>`
`i8` implements `Add<&i8>`
`i8` implements `Add`

error[E0604]: only `u8` can be cast as `char`, not `i8`
--> $DIR/const-eval-overflow-4b.rs:22:13
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/consts/too_generic_eval_ice.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ LL | [5; Self::HOST_SIZE] == [6; 0]
|
= help: the trait `PartialEq<[{integer}; 0]>` is not implemented for `[{integer}; Self::HOST_SIZE]`
= help: the following other types implement trait `PartialEq<Rhs>`:
<&[T] as PartialEq<Vec<U, A>>>
<&[T] as PartialEq<[U; N]>>
<&mut [T] as PartialEq<Vec<U, A>>>
<&mut [T] as PartialEq<[U; N]>>
<[T; N] as PartialEq<&[U]>>
<[T; N] as PartialEq<&mut [U]>>
<[T; N] as PartialEq<[U; N]>>
<[T; N] as PartialEq<[U]>>
`&[T]` implements `PartialEq<Vec<U, A>>`
`&[T]` implements `PartialEq<[U; N]>`
`&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

error: aborting due to 3 previous errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ LL | f1.foo(1usize);
| required by a bound introduced by this call
|
= help: the following other types implement trait `Foo<A>`:
<Bar as Foo<i32>>
<Bar as Foo<u8>>
`Bar` implements `Foo<i32>`
`Bar` implements `Foo<u8>`

error: aborting due to 1 previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ LL | f1.foo(1usize);
| required by a bound introduced by this call
|
= help: the following other types implement trait `Foo<A>`:
<Bar as Foo<i16>>
<Bar as Foo<i32>>
<Bar as Foo<i8>>
<Bar as Foo<u16>>
<Bar as Foo<u32>>
<Bar as Foo<u8>>
`Bar` implements `Foo<i16>`
`Bar` implements `Foo<i32>`
`Bar` implements `Foo<i8>`
`Bar` implements `Foo<u16>`
`Bar` implements `Foo<u32>`
`Bar` implements `Foo<u8>`

error: aborting due to 1 previous error

Expand Down
30 changes: 15 additions & 15 deletions tests/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ LL | Foo::<i32>::bar(&1i8);
| required by a bound introduced by this call
|
= help: the following other types implement trait `Foo<B>`:
<i8 as Foo<bool>>
<i8 as Foo<u16>>
<i8 as Foo<u32>>
<i8 as Foo<u64>>
<i8 as Foo<u8>>
`i8` implements `Foo<bool>`
`i8` implements `Foo<u16>`
`i8` implements `Foo<u32>`
`i8` implements `Foo<u64>`
`i8` implements `Foo<u8>`

error[E0277]: the trait bound `u8: Foo<i32>` is not satisfied
--> $DIR/issue-39802-show-5-trait-impls.rs:25:21
Expand All @@ -22,10 +22,10 @@ LL | Foo::<i32>::bar(&1u8);
| required by a bound introduced by this call
|
= help: the following other types implement trait `Foo<B>`:
<u8 as Foo<bool>>
<u8 as Foo<u16>>
<u8 as Foo<u32>>
<u8 as Foo<u64>>
`u8` implements `Foo<bool>`
`u8` implements `Foo<u16>`
`u8` implements `Foo<u32>`
`u8` implements `Foo<u64>`

error[E0277]: the trait bound `bool: Foo<i32>` is not satisfied
--> $DIR/issue-39802-show-5-trait-impls.rs:26:21
Expand All @@ -36,12 +36,12 @@ LL | Foo::<i32>::bar(&true);
| required by a bound introduced by this call
|
= help: the following other types implement trait `Foo<B>`:
<bool as Foo<bool>>
<bool as Foo<i8>>
<bool as Foo<u16>>
<bool as Foo<u32>>
<bool as Foo<u64>>
<bool as Foo<u8>>
`bool` implements `Foo<bool>`
`bool` implements `Foo<i8>`
`bool` implements `Foo<u16>`
`bool` implements `Foo<u32>`
`bool` implements `Foo<u64>`
`bool` implements `Foo<u8>`

error: aborting due to 3 previous errors

Expand Down
8 changes: 4 additions & 4 deletions tests/ui/impl-trait/equality.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ LL | n + sum_to(n - 1)
|
= help: the trait `Add<impl Foo>` is not implemented for `u32`
= help: the following other types implement trait `Add<Rhs>`:
<&'a u32 as Add<u32>>
<&u32 as Add<&u32>>
<u32 as Add<&u32>>
<u32 as Add>
`&'a u32` implements `Add<u32>`
`&u32` implements `Add<&u32>`
`u32` implements `Add<&u32>`
`u32` implements `Add`

error: aborting due to 2 previous errors; 1 warning emitted

Expand Down
32 changes: 16 additions & 16 deletions tests/ui/issues/issue-11771.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ LL | 1 +
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f128 as Add<f128>>
<&'a f16 as Add<f16>>
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
`&'a f128` implements `Add<f128>`
`&'a f16` implements `Add<f16>`
`&'a f32` implements `Add<f32>`
`&'a f64` implements `Add<f64>`
`&'a i128` implements `Add<i128>`
`&'a i16` implements `Add<i16>`
`&'a i32` implements `Add<i32>`
`&'a i64` implements `Add<i64>`
and 56 others

error[E0277]: cannot add `()` to `{integer}`
Expand All @@ -24,14 +24,14 @@ LL | 1 +
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f128 as Add<f128>>
<&'a f16 as Add<f16>>
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
`&'a f128` implements `Add<f128>`
`&'a f16` implements `Add<f16>`
`&'a f32` implements `Add<f32>`
`&'a f64` implements `Add<f64>`
`&'a i128` implements `Add<i128>`
`&'a i16` implements `Add<i16>`
`&'a i32` implements `Add<i32>`
`&'a i64` implements `Add<i64>`
and 56 others

error: aborting due to 2 previous errors
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/issues/issue-24352.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ LL | 1.0f64 - 1
|
= help: the trait `Sub<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Sub<Rhs>`:
<&'a f64 as Sub<f64>>
<&f64 as Sub<&f64>>
<f64 as Sub<&f64>>
<f64 as Sub>
`&'a f64` implements `Sub<f64>`
`&f64` implements `Sub<&f64>`
`f64` implements `Sub<&f64>`
`f64` implements `Sub`
help: consider using a floating-point literal by writing it with `.0`
|
LL | 1.0f64 - 1.0
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/issues/issue-50582.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f128 as Add<f128>>
<&'a f16 as Add<f16>>
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
`&'a f128` implements `Add<f128>`
`&'a f16` implements `Add<f16>`
`&'a f32` implements `Add<f32>`
`&'a f64` implements `Add<f64>`
`&'a i128` implements `Add<i128>`
`&'a i16` implements `Add<i16>`
`&'a i32` implements `Add<i32>`
`&'a i64` implements `Add<i64>`
and 56 others

error: aborting due to 2 previous errors
Expand Down
12 changes: 6 additions & 6 deletions tests/ui/iterators/invalid-iterator-chain-fixable.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ LL | println!("{}", scores.sum::<i32>());
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
<i32 as Sum<&'a i32>>
<i32 as Sum>
`i32` implements `Sum<&'a i32>`
`i32` implements `Sum`
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain-fixable.rs:14:10
|
Expand Down Expand Up @@ -66,8 +66,8 @@ LL | .sum::<i32>(),
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
<i32 as Sum<&'a i32>>
<i32 as Sum>
`i32` implements `Sum<&'a i32>`
`i32` implements `Sum`
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain-fixable.rs:23:14
|
Expand Down Expand Up @@ -99,8 +99,8 @@ LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
<i32 as Sum<&'a i32>>
<i32 as Sum>
`i32` implements `Sum<&'a i32>`
`i32` implements `Sum`
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain-fixable.rs:27:38
|
Expand Down
Loading
Loading