summary refs log tree commit diff
path: root/src/test/ui/error-codes
diff options
context:
space:
mode:
authorBasile Desloges <basile.desloges@gmail.com>2018-02-07 16:26:35 +0100
committerBasile Desloges <basile.desloges@gmail.com>2018-03-08 22:28:52 +0100
commit0e68bb97285a1ade22cf6e68103dc54fb75db43f (patch)
tree06f94d8aaee1a5cf091a2d23a566270def7d00c5 /src/test/ui/error-codes
parent48ba50e10c275c55d5480a5102e53bdb5a977ad7 (diff)
downloadrust-0e68bb97285a1ade22cf6e68103dc54fb75db43f.tar.gz
rust-0e68bb97285a1ade22cf6e68103dc54fb75db43f.zip
Update tests
Diffstat (limited to 'src/test/ui/error-codes')
-rw-r--r--src/test/ui/error-codes/E0401.rs24
-rw-r--r--src/test/ui/error-codes/E0401.stderr36
2 files changed, 54 insertions, 6 deletions
diff --git a/src/test/ui/error-codes/E0401.rs b/src/test/ui/error-codes/E0401.rs
index 09bc950efd2..15b94662577 100644
--- a/src/test/ui/error-codes/E0401.rs
+++ b/src/test/ui/error-codes/E0401.rs
@@ -8,11 +8,33 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+trait Baz<T> {}
+
 fn foo<T>(x: T) {
-    fn bar(y: T) { //~ ERROR E0401
+    fn bar<U, V: Baz<U>, W: Fn()>(y: T) { //~ ERROR E0401
+    }
+    fn baz<U,
+           V: Baz<U>,
+           W: Fn()>
+           (y: T) { //~ ERROR E0401
     }
     bar(x);
 }
 
+
+struct A<T> {
+    inner: T,
+}
+
+impl<T> Iterator for A<T> {
+    type Item = u8;
+    fn next(&mut self) -> Option<u8> {
+        fn helper(sel: &Self) -> u8 { //~ ERROR E0401
+            unimplemented!();
+        }
+        Some(helper(self))
+    }
+}
+
 fn main() {
 }
diff --git a/src/test/ui/error-codes/E0401.stderr b/src/test/ui/error-codes/E0401.stderr
index 15e1eda7722..c306ff4a04f 100644
--- a/src/test/ui/error-codes/E0401.stderr
+++ b/src/test/ui/error-codes/E0401.stderr
@@ -1,9 +1,35 @@
-error[E0401]: can't use type parameters from outer function; try using a local type parameter instead
-  --> $DIR/E0401.rs:12:15
+error[E0401]: can't use type parameters from outer function
+  --> $DIR/E0401.rs:14:38
    |
-LL |     fn bar(y: T) { //~ ERROR E0401
-   |               ^ use of type variable from outer function
+LL | fn foo<T>(x: T) {
+   |        - type variable from outer function
+LL |     fn bar<U, V: Baz<U>, W: Fn()>(y: T) { //~ ERROR E0401
+   |        --------------------------    ^ use of type variable from outer function
+   |        |
+   |        help: try using a local type parameter instead: `bar<U, V: Baz<U>, W: Fn(), T>`
 
-error: aborting due to previous error
+error[E0401]: can't use type parameters from outer function
+  --> $DIR/E0401.rs:19:16
+   |
+LL | fn foo<T>(x: T) {
+   |        - type variable from outer function
+...
+LL |            (y: T) { //~ ERROR E0401
+   |                ^ use of type variable from outer function
+   |
+   = help: try using a local type parameter instead
+
+error[E0401]: can't use type parameters from outer function
+  --> $DIR/E0401.rs:32:25
+   |
+LL | impl<T> Iterator for A<T> {
+   | ---- `Self` type implicitely declared here, on the `impl`
+...
+LL |         fn helper(sel: &Self) -> u8 { //~ ERROR E0401
+   |            ------       ^^^^ use of type variable from outer function
+   |            |
+   |            help: try using a local type parameter instead: `helper<Self>`
+
+error: aborting due to 3 previous errors
 
 If you want more information on this error, try using "rustc --explain E0401"