Add test tests/ui/trait-bounds/false-span-in-trait-bound-label.rs

Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
This commit is contained in:
xizheyin 2025-07-07 16:30:14 +08:00
parent 0d11be5aab
commit cf7e896cf8
No known key found for this signature in database
GPG key ID: 0A0D90BE99CEDEAD
2 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,10 @@
// In this test, the span of the trait bound label should point to `1`, not `""`.
// See issue #1433376
trait A<T> {
fn f(self, x: T);
}
fn main() {
A::f(1, ""); //~ ERROR the trait bound `{integer}: A<_>` is not satisfied [E0277]
}

View file

@ -0,0 +1,17 @@
error[E0277]: the trait bound `{integer}: A<_>` is not satisfied
--> $DIR/false-span-in-trait-bound-label.rs:9:13
|
LL | A::f(1, "");
| ---- ^^ the trait `A<_>` is not implemented for `{integer}`
| |
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> $DIR/false-span-in-trait-bound-label.rs:4:1
|
LL | trait A<T> {
| ^^^^^^^^^^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.