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:
parent
0d11be5aab
commit
cf7e896cf8
2 changed files with 27 additions and 0 deletions
10
tests/ui/trait-bounds/false-span-in-trait-bound-label.rs
Normal file
10
tests/ui/trait-bounds/false-span-in-trait-bound-label.rs
Normal 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]
|
||||
}
|
||||
17
tests/ui/trait-bounds/false-span-in-trait-bound-label.stderr
Normal file
17
tests/ui/trait-bounds/false-span-in-trait-bound-label.stderr
Normal 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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue