diff options
| author | xizheyin <xizheyin@smail.nju.edu.cn> | 2025-07-07 16:30:14 +0800 |
|---|---|---|
| committer | xizheyin <xizheyin@smail.nju.edu.cn> | 2025-07-07 16:30:14 +0800 |
| commit | cf7e896cf8f2dd744f2690c236dd818eeb86ccc2 (patch) | |
| tree | 764395629d6228dd9902d40e7412d9ca7eb3392a /tests/ui/trait-bounds | |
| parent | 0d11be5aabe0cd49609fff5fce57c4691a22fe55 (diff) | |
| download | rust-cf7e896cf8f2dd744f2690c236dd818eeb86ccc2.tar.gz rust-cf7e896cf8f2dd744f2690c236dd818eeb86ccc2.zip | |
Add test tests/ui/trait-bounds/false-span-in-trait-bound-label.rs
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
Diffstat (limited to 'tests/ui/trait-bounds')
| -rw-r--r-- | tests/ui/trait-bounds/false-span-in-trait-bound-label.rs | 10 | ||||
| -rw-r--r-- | tests/ui/trait-bounds/false-span-in-trait-bound-label.stderr | 17 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/trait-bounds/false-span-in-trait-bound-label.rs b/tests/ui/trait-bounds/false-span-in-trait-bound-label.rs new file mode 100644 index 00000000000..7a9157350ac --- /dev/null +++ b/tests/ui/trait-bounds/false-span-in-trait-bound-label.rs @@ -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] +} \ No newline at end of file diff --git a/tests/ui/trait-bounds/false-span-in-trait-bound-label.stderr b/tests/ui/trait-bounds/false-span-in-trait-bound-label.stderr new file mode 100644 index 00000000000..a1024380467 --- /dev/null +++ b/tests/ui/trait-bounds/false-span-in-trait-bound-label.stderr @@ -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`. |
