Files
rust/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr
xizheyin 796b4d1fb4 Point to correct argument in Func Call when Self type fails trait bound
When a trait bound fails due to the Self type parameter, adjust_fulfillment_errors
now correctly points to the corresponding function argument instead of incorrectly
pointing to other arguments.

Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-07 16:47:15 +08:00

64 lines
2.5 KiB
Plaintext

error[E0277]: the trait bound `dyn CompareToInts: CompareTo<i32>` is not satisfied
--> $DIR/repeated-supertrait-ambig.rs:26:15
|
LL | c.same_as(22)
| ------- ^^ the trait `CompareTo<i32>` is not implemented for `dyn CompareToInts`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `CompareTo<T>`:
`i64` implements `CompareTo<i64>`
`i64` implements `CompareTo<u64>`
error[E0277]: the trait bound `C: CompareTo<i32>` is not satisfied
--> $DIR/repeated-supertrait-ambig.rs:30:15
|
LL | c.same_as(22)
| ------- ^^ the trait `CompareTo<i32>` is not implemented for `C`
| |
| required by a bound introduced by this call
|
help: consider further restricting type parameter `C` with trait `CompareTo`
|
LL | fn with_trait<C:CompareToInts + CompareTo<i32>>(c: &C) -> bool {
| ++++++++++++++++
error[E0277]: the trait bound `dyn CompareToInts: CompareTo<i32>` is not satisfied
--> $DIR/repeated-supertrait-ambig.rs:34:6
|
LL | <dyn CompareToInts>::same_as(c, 22)
| ^^^^^^^^^^^^^^^^^ the trait `CompareTo<i32>` is not implemented for `dyn CompareToInts`
|
= help: the following other types implement trait `CompareTo<T>`:
`i64` implements `CompareTo<i64>`
`i64` implements `CompareTo<u64>`
error[E0277]: the trait bound `C: CompareTo<i32>` is not satisfied
--> $DIR/repeated-supertrait-ambig.rs:38:24
|
LL | CompareTo::same_as(c, 22)
| ------------------ ^ the trait `CompareTo<i32>` is not implemented for `C`
| |
| required by a bound introduced by this call
|
help: consider further restricting type parameter `C` with trait `CompareTo`
|
LL | fn with_ufcs2<C:CompareToInts + CompareTo<i32>>(c: &C) -> bool {
| ++++++++++++++++
error[E0277]: the trait bound `i64: CompareTo<i32>` is not satisfied
--> $DIR/repeated-supertrait-ambig.rs:42:31
|
LL | assert_eq!(22_i64.same_as(22), true);
| ------- ^^ the trait `CompareTo<i32>` is not implemented for `i64`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `CompareTo<T>`:
`i64` implements `CompareTo<i64>`
`i64` implements `CompareTo<u64>`
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0277`.