about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/trait-bounds/false-span-in-trait-bound-label.rs10
-rw-r--r--tests/ui/trait-bounds/false-span-in-trait-bound-label.stderr17
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`.