diff options
| author | Basile Desloges <basile.desloges@gmail.com> | 2018-02-07 16:26:35 +0100 |
|---|---|---|
| committer | Basile Desloges <basile.desloges@gmail.com> | 2018-03-08 22:28:52 +0100 |
| commit | 0e68bb97285a1ade22cf6e68103dc54fb75db43f (patch) | |
| tree | 06f94d8aaee1a5cf091a2d23a566270def7d00c5 | |
| parent | 48ba50e10c275c55d5480a5102e53bdb5a977ad7 (diff) | |
| download | rust-0e68bb97285a1ade22cf6e68103dc54fb75db43f.tar.gz rust-0e68bb97285a1ade22cf6e68103dc54fb75db43f.zip | |
Update tests
| -rw-r--r-- | src/test/compile-fail/inner-static-type-parameter.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-3021-c.rs | 4 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-3214.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-5997-struct.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/nested-ty-params.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/type-arg-out-of-scope.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0401.rs | 24 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0401.stderr | 36 |
8 files changed, 61 insertions, 13 deletions
diff --git a/src/test/compile-fail/inner-static-type-parameter.rs b/src/test/compile-fail/inner-static-type-parameter.rs index 6fb497092d2..4d763017c0f 100644 --- a/src/test/compile-fail/inner-static-type-parameter.rs +++ b/src/test/compile-fail/inner-static-type-parameter.rs @@ -14,7 +14,7 @@ enum Bar<T> { What } //~ ERROR parameter `T` is never used fn foo<T>() { static a: Bar<T> = Bar::What; -//~^ ERROR can't use type parameters from outer function; try using a local type parameter instead +//~^ ERROR can't use type parameters from outer function } fn main() { diff --git a/src/test/compile-fail/issue-3021-c.rs b/src/test/compile-fail/issue-3021-c.rs index 635006a3b4d..55975cc8e86 100644 --- a/src/test/compile-fail/issue-3021-c.rs +++ b/src/test/compile-fail/issue-3021-c.rs @@ -11,8 +11,8 @@ fn siphash<T>() { trait t { - fn g(&self, x: T) -> T; //~ ERROR can't use type parameters from outer function; try using - //~^ ERROR can't use type parameters from outer function; try using + fn g(&self, x: T) -> T; //~ ERROR can't use type parameters from outer function + //~^ ERROR can't use type parameters from outer function } } diff --git a/src/test/compile-fail/issue-3214.rs b/src/test/compile-fail/issue-3214.rs index 010cfb54c1a..9a769c39eca 100644 --- a/src/test/compile-fail/issue-3214.rs +++ b/src/test/compile-fail/issue-3214.rs @@ -10,7 +10,7 @@ fn foo<T>() { struct foo { - x: T, //~ ERROR can't use type parameters from outer function; + x: T, //~ ERROR can't use type parameters from outer function } impl<T> Drop for foo<T> { diff --git a/src/test/compile-fail/issue-5997-struct.rs b/src/test/compile-fail/issue-5997-struct.rs index e9cfafc98df..af9e66b770b 100644 --- a/src/test/compile-fail/issue-5997-struct.rs +++ b/src/test/compile-fail/issue-5997-struct.rs @@ -9,7 +9,7 @@ // except according to those terms. fn f<T>() -> bool { - struct S(T); //~ ERROR can't use type parameters from outer function; try using + struct S(T); //~ ERROR can't use type parameters from outer function true } diff --git a/src/test/compile-fail/nested-ty-params.rs b/src/test/compile-fail/nested-ty-params.rs index 0ee2a3add87..aac37289bb7 100644 --- a/src/test/compile-fail/nested-ty-params.rs +++ b/src/test/compile-fail/nested-ty-params.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:can't use type parameters from outer function; try using +// error-pattern:can't use type parameters from outer function fn hd<U>(v: Vec<U> ) -> U { fn hd1(w: [U]) -> U { return w[0]; } diff --git a/src/test/compile-fail/type-arg-out-of-scope.rs b/src/test/compile-fail/type-arg-out-of-scope.rs index 3249794e5c8..04cd961e97f 100644 --- a/src/test/compile-fail/type-arg-out-of-scope.rs +++ b/src/test/compile-fail/type-arg-out-of-scope.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:can't use type parameters from outer function; try using +// error-pattern:can't use type parameters from outer function fn foo<T>(x: T) { fn bar(f: Box<FnMut(T) -> T>) { } } 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" |
