summaryrefslogtreecommitdiffstats
path: root/src/test/ui/on-unimplemented
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/on-unimplemented')
-rw-r--r--src/test/ui/on-unimplemented/enclosing-scope.rs27
-rw-r--r--src/test/ui/on-unimplemented/enclosing-scope.stderr86
-rw-r--r--src/test/ui/on-unimplemented/multiple-impls.rs3
-rw-r--r--src/test/ui/on-unimplemented/multiple-impls.stderr51
-rw-r--r--src/test/ui/on-unimplemented/on-impl.rs1
-rw-r--r--src/test/ui/on-unimplemented/on-impl.stderr15
-rw-r--r--src/test/ui/on-unimplemented/parent-label.rs27
-rw-r--r--src/test/ui/on-unimplemented/parent-label.stderr69
-rw-r--r--src/test/ui/on-unimplemented/slice-index.stderr4
9 files changed, 156 insertions, 127 deletions
diff --git a/src/test/ui/on-unimplemented/enclosing-scope.rs b/src/test/ui/on-unimplemented/enclosing-scope.rs
deleted file mode 100644
index 881bff63f..000000000
--- a/src/test/ui/on-unimplemented/enclosing-scope.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Test scope annotations from `enclosing_scope` parameter
-
-#![feature(rustc_attrs)]
-
-#[rustc_on_unimplemented(enclosing_scope="in this scope")]
-trait Trait{}
-
-struct Foo;
-
-fn f<T: Trait>(x: T) {}
-
-fn main() {
- let x = || {
- f(Foo{}); //~ ERROR the trait bound `Foo: Trait` is not satisfied
- let y = || {
- f(Foo{}); //~ ERROR the trait bound `Foo: Trait` is not satisfied
- };
- };
-
- {
- {
- f(Foo{}); //~ ERROR the trait bound `Foo: Trait` is not satisfied
- }
- }
-
- f(Foo{}); //~ ERROR the trait bound `Foo: Trait` is not satisfied
-}
diff --git a/src/test/ui/on-unimplemented/enclosing-scope.stderr b/src/test/ui/on-unimplemented/enclosing-scope.stderr
deleted file mode 100644
index 67759d02a..000000000
--- a/src/test/ui/on-unimplemented/enclosing-scope.stderr
+++ /dev/null
@@ -1,86 +0,0 @@
-error[E0277]: the trait bound `Foo: Trait` is not satisfied
- --> $DIR/enclosing-scope.rs:14:11
- |
-LL | let x = || {
- | _____________-
-LL | | f(Foo{});
- | | - ^^^^^ the trait `Trait` is not implemented for `Foo`
- | | |
- | | required by a bound introduced by this call
-LL | | let y = || {
-LL | | f(Foo{});
-LL | | };
-LL | | };
- | |_____- in this scope
- |
-note: required by a bound in `f`
- --> $DIR/enclosing-scope.rs:10:9
- |
-LL | fn f<T: Trait>(x: T) {}
- | ^^^^^ required by this bound in `f`
-
-error[E0277]: the trait bound `Foo: Trait` is not satisfied
- --> $DIR/enclosing-scope.rs:16:15
- |
-LL | let y = || {
- | _________________-
-LL | | f(Foo{});
- | | - ^^^^^ the trait `Trait` is not implemented for `Foo`
- | | |
- | | required by a bound introduced by this call
-LL | | };
- | |_________- in this scope
- |
-note: required by a bound in `f`
- --> $DIR/enclosing-scope.rs:10:9
- |
-LL | fn f<T: Trait>(x: T) {}
- | ^^^^^ required by this bound in `f`
-
-error[E0277]: the trait bound `Foo: Trait` is not satisfied
- --> $DIR/enclosing-scope.rs:22:15
- |
-LL | / fn main() {
-LL | | let x = || {
-LL | | f(Foo{});
-LL | | let y = || {
-... |
-LL | | f(Foo{});
- | | - ^^^^^ the trait `Trait` is not implemented for `Foo`
- | | |
- | | required by a bound introduced by this call
-... |
-LL | | f(Foo{});
-LL | | }
- | |_- in this scope
- |
-note: required by a bound in `f`
- --> $DIR/enclosing-scope.rs:10:9
- |
-LL | fn f<T: Trait>(x: T) {}
- | ^^^^^ required by this bound in `f`
-
-error[E0277]: the trait bound `Foo: Trait` is not satisfied
- --> $DIR/enclosing-scope.rs:26:7
- |
-LL | / fn main() {
-LL | | let x = || {
-LL | | f(Foo{});
-LL | | let y = || {
-... |
-LL | | f(Foo{});
- | | - ^^^^^ the trait `Trait` is not implemented for `Foo`
- | | |
- | | required by a bound introduced by this call
-LL | | }
- | |_- in this scope
- |
-note: required by a bound in `f`
- --> $DIR/enclosing-scope.rs:10:9
- |
-LL | fn f<T: Trait>(x: T) {}
- | ^^^^^ required by this bound in `f`
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/on-unimplemented/multiple-impls.rs b/src/test/ui/on-unimplemented/multiple-impls.rs
index b74957ebc..a32fd4566 100644
--- a/src/test/ui/on-unimplemented/multiple-impls.rs
+++ b/src/test/ui/on-unimplemented/multiple-impls.rs
@@ -33,10 +33,13 @@ fn main() {
Index::index(&[] as &[i32], 2u32);
//~^ ERROR E0277
//~| ERROR E0277
+ //~| ERROR E0277
Index::index(&[] as &[i32], Foo(2u32));
//~^ ERROR E0277
//~| ERROR E0277
+ //~| ERROR E0277
Index::index(&[] as &[i32], Bar(2u32));
//~^ ERROR E0277
//~| ERROR E0277
+ //~| ERROR E0277
}
diff --git a/src/test/ui/on-unimplemented/multiple-impls.stderr b/src/test/ui/on-unimplemented/multiple-impls.stderr
index 06e1a222a..d628b159a 100644
--- a/src/test/ui/on-unimplemented/multiple-impls.stderr
+++ b/src/test/ui/on-unimplemented/multiple-impls.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
- --> $DIR/multiple-impls.rs:33:18
+ --> $DIR/multiple-impls.rs:33:33
|
LL | Index::index(&[] as &[i32], 2u32);
- | ------------ ^^^^^^^^^^^^^ trait message
+ | ------------ ^^^^ trait message
| |
| required by a bound introduced by this call
|
@@ -11,11 +11,22 @@ LL | Index::index(&[] as &[i32], 2u32);
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
+error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
+ --> $DIR/multiple-impls.rs:33:5
+ |
+LL | Index::index(&[] as &[i32], 2u32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait message
+ |
+ = help: the trait `Index<u32>` is not implemented for `[i32]`
+ = help: the following other types implement trait `Index<Idx>`:
+ <[i32] as Index<Bar<usize>>>
+ <[i32] as Index<Foo<usize>>>
+
error[E0277]: the trait bound `[i32]: Index<Foo<u32>>` is not satisfied
- --> $DIR/multiple-impls.rs:36:18
+ --> $DIR/multiple-impls.rs:37:33
|
LL | Index::index(&[] as &[i32], Foo(2u32));
- | ------------ ^^^^^^^^^^^^^ on impl for Foo
+ | ------------ ^^^^^^^^^ on impl for Foo
| |
| required by a bound introduced by this call
|
@@ -24,11 +35,22 @@ LL | Index::index(&[] as &[i32], Foo(2u32));
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
+error[E0277]: the trait bound `[i32]: Index<Foo<u32>>` is not satisfied
+ --> $DIR/multiple-impls.rs:37:5
+ |
+LL | Index::index(&[] as &[i32], Foo(2u32));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ on impl for Foo
+ |
+ = help: the trait `Index<Foo<u32>>` is not implemented for `[i32]`
+ = help: the following other types implement trait `Index<Idx>`:
+ <[i32] as Index<Bar<usize>>>
+ <[i32] as Index<Foo<usize>>>
+
error[E0277]: the trait bound `[i32]: Index<Bar<u32>>` is not satisfied
- --> $DIR/multiple-impls.rs:39:18
+ --> $DIR/multiple-impls.rs:41:33
|
LL | Index::index(&[] as &[i32], Bar(2u32));
- | ------------ ^^^^^^^^^^^^^ on impl for Bar
+ | ------------ ^^^^^^^^^ on impl for Bar
| |
| required by a bound introduced by this call
|
@@ -37,6 +59,17 @@ LL | Index::index(&[] as &[i32], Bar(2u32));
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
+error[E0277]: the trait bound `[i32]: Index<Bar<u32>>` is not satisfied
+ --> $DIR/multiple-impls.rs:41:5
+ |
+LL | Index::index(&[] as &[i32], Bar(2u32));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ on impl for Bar
+ |
+ = help: the trait `Index<Bar<u32>>` is not implemented for `[i32]`
+ = help: the following other types implement trait `Index<Idx>`:
+ <[i32] as Index<Bar<usize>>>
+ <[i32] as Index<Foo<usize>>>
+
error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
--> $DIR/multiple-impls.rs:33:5
|
@@ -49,7 +82,7 @@ LL | Index::index(&[] as &[i32], 2u32);
<[i32] as Index<Foo<usize>>>
error[E0277]: the trait bound `[i32]: Index<Foo<u32>>` is not satisfied
- --> $DIR/multiple-impls.rs:36:5
+ --> $DIR/multiple-impls.rs:37:5
|
LL | Index::index(&[] as &[i32], Foo(2u32));
| ^^^^^^^^^^^^ on impl for Foo
@@ -60,7 +93,7 @@ LL | Index::index(&[] as &[i32], Foo(2u32));
<[i32] as Index<Foo<usize>>>
error[E0277]: the trait bound `[i32]: Index<Bar<u32>>` is not satisfied
- --> $DIR/multiple-impls.rs:39:5
+ --> $DIR/multiple-impls.rs:41:5
|
LL | Index::index(&[] as &[i32], Bar(2u32));
| ^^^^^^^^^^^^ on impl for Bar
@@ -70,6 +103,6 @@ LL | Index::index(&[] as &[i32], Bar(2u32));
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
-error: aborting due to 6 previous errors
+error: aborting due to 9 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/on-unimplemented/on-impl.rs b/src/test/ui/on-unimplemented/on-impl.rs
index ab3e67d01..d0537810c 100644
--- a/src/test/ui/on-unimplemented/on-impl.rs
+++ b/src/test/ui/on-unimplemented/on-impl.rs
@@ -22,4 +22,5 @@ fn main() {
Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
//~^ ERROR E0277
//~| ERROR E0277
+ //~| ERROR E0277
}
diff --git a/src/test/ui/on-unimplemented/on-impl.stderr b/src/test/ui/on-unimplemented/on-impl.stderr
index 769a3d77a..2253c5992 100644
--- a/src/test/ui/on-unimplemented/on-impl.stderr
+++ b/src/test/ui/on-unimplemented/on-impl.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
- --> $DIR/on-impl.rs:22:25
+ --> $DIR/on-impl.rs:22:47
|
LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
- | ------------------- ^^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice
+ | ------------------- ^^^^ a usize is required to index into a slice
| |
| required by a bound introduced by this call
|
@@ -13,11 +13,20 @@ error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
--> $DIR/on-impl.rs:22:5
|
LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice
+ |
+ = help: the trait `Index<u32>` is not implemented for `[i32]`
+ = help: the trait `Index<usize>` is implemented for `[i32]`
+
+error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
+ --> $DIR/on-impl.rs:22:5
+ |
+LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
| ^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the trait `Index<usize>` is implemented for `[i32]`
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/on-unimplemented/parent-label.rs b/src/test/ui/on-unimplemented/parent-label.rs
new file mode 100644
index 000000000..b65f64968
--- /dev/null
+++ b/src/test/ui/on-unimplemented/parent-label.rs
@@ -0,0 +1,27 @@
+// Test scope annotations from `parent_label` parameter
+
+#![feature(rustc_attrs)]
+
+#[rustc_on_unimplemented(parent_label = "in this scope")]
+trait Trait {}
+
+struct Foo;
+
+fn f<T: Trait>(x: T) {}
+
+fn main() {
+ let x = || {
+ f(Foo {}); //~ ERROR the trait bound `Foo: Trait` is not satisfied
+ let y = || {
+ f(Foo {}); //~ ERROR the trait bound `Foo: Trait` is not satisfied
+ };
+ };
+
+ {
+ {
+ f(Foo {}); //~ ERROR the trait bound `Foo: Trait` is not satisfied
+ }
+ }
+
+ f(Foo {}); //~ ERROR the trait bound `Foo: Trait` is not satisfied
+}
diff --git a/src/test/ui/on-unimplemented/parent-label.stderr b/src/test/ui/on-unimplemented/parent-label.stderr
new file mode 100644
index 000000000..8cd7412fd
--- /dev/null
+++ b/src/test/ui/on-unimplemented/parent-label.stderr
@@ -0,0 +1,69 @@
+error[E0277]: the trait bound `Foo: Trait` is not satisfied
+ --> $DIR/parent-label.rs:14:11
+ |
+LL | let x = || {
+ | -- in this scope
+LL | f(Foo {});
+ | - ^^^^^^ the trait `Trait` is not implemented for `Foo`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `f`
+ --> $DIR/parent-label.rs:10:9
+ |
+LL | fn f<T: Trait>(x: T) {}
+ | ^^^^^ required by this bound in `f`
+
+error[E0277]: the trait bound `Foo: Trait` is not satisfied
+ --> $DIR/parent-label.rs:16:15
+ |
+LL | let y = || {
+ | -- in this scope
+LL | f(Foo {});
+ | - ^^^^^^ the trait `Trait` is not implemented for `Foo`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `f`
+ --> $DIR/parent-label.rs:10:9
+ |
+LL | fn f<T: Trait>(x: T) {}
+ | ^^^^^ required by this bound in `f`
+
+error[E0277]: the trait bound `Foo: Trait` is not satisfied
+ --> $DIR/parent-label.rs:22:15
+ |
+LL | fn main() {
+ | --------- in this scope
+...
+LL | f(Foo {});
+ | - ^^^^^^ the trait `Trait` is not implemented for `Foo`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `f`
+ --> $DIR/parent-label.rs:10:9
+ |
+LL | fn f<T: Trait>(x: T) {}
+ | ^^^^^ required by this bound in `f`
+
+error[E0277]: the trait bound `Foo: Trait` is not satisfied
+ --> $DIR/parent-label.rs:26:7
+ |
+LL | fn main() {
+ | --------- in this scope
+...
+LL | f(Foo {});
+ | - ^^^^^^ the trait `Trait` is not implemented for `Foo`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `f`
+ --> $DIR/parent-label.rs:10:9
+ |
+LL | fn f<T: Trait>(x: T) {}
+ | ^^^^^ required by this bound in `f`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/on-unimplemented/slice-index.stderr b/src/test/ui/on-unimplemented/slice-index.stderr
index 72f67a685..a7ec3bda8 100644
--- a/src/test/ui/on-unimplemented/slice-index.stderr
+++ b/src/test/ui/on-unimplemented/slice-index.stderr
@@ -6,7 +6,7 @@ LL | x[1i32];
|
= help: the trait `SliceIndex<[i32]>` is not implemented for `i32`
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
- = note: required because of the requirements on the impl of `Index<i32>` for `[i32]`
+ = note: required for `[i32]` to implement `Index<i32>`
error[E0277]: the type `[i32]` cannot be indexed by `RangeTo<i32>`
--> $DIR/slice-index.rs:9:7
@@ -18,7 +18,7 @@ LL | x[..1i32];
= help: the following other types implement trait `SliceIndex<T>`:
<RangeTo<usize> as SliceIndex<[T]>>
<RangeTo<usize> as SliceIndex<str>>
- = note: required because of the requirements on the impl of `Index<RangeTo<i32>>` for `[i32]`
+ = note: required for `[i32]` to implement `Index<RangeTo<i32>>`
error: aborting due to 2 previous errors