Skip to content

Commit

Permalink
Updated tests to reflect specified types in E0121
Browse files Browse the repository at this point in the history
  • Loading branch information
fee1-dead committed Jun 21, 2021
1 parent 200fdaa commit 9b6c7ff
Show file tree
Hide file tree
Showing 29 changed files with 363 additions and 366 deletions.
20 changes: 10 additions & 10 deletions src/test/ui/did_you_mean/bad-assoc-ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type D = (u8, u8)::AssocTy;

type E = _::AssocTy;
//~^ ERROR missing angle brackets in associated item path
//~| ERROR the type placeholder `_` is not allowed within types on item signatures
//~| ERROR the type placeholder `_` is not allowed within types on item signatures for type aliases

type F = &'static (u8)::AssocTy;
//~^ ERROR missing angle brackets in associated item path
Expand Down Expand Up @@ -47,37 +47,37 @@ type I = ty!()::AssocTy;

trait K<A, B> {}
fn foo<X: K<_, _>>(x: X) {}
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions

fn bar<F>(_: F) where F: Fn() -> _ {}
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions

fn baz<F: Fn() -> _>(_: F) {}
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions

struct L<F>(F) where F: Fn() -> _;
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for structs
struct M<F> where F: Fn() -> _ {
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for structs
a: F,
}
enum N<F> where F: Fn() -> _ {
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for enums
Foo(F),
}

union O<F> where F: Fn() -> _ {
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for unions
foo: F,
}

trait P<F> where F: Fn() -> _ {
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for traits
}

trait Q {
fn foo<F>(_: F) where F: Fn() -> _ {}
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
}

fn main() {}
20 changes: 10 additions & 10 deletions src/test/ui/did_you_mean/bad-assoc-ty.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ error[E0223]: ambiguous associated type
LL | type D = (u8, u8)::AssocTy;
| ^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(u8, u8) as Trait>::AssocTy`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for type aliases
--> $DIR/bad-assoc-ty.rs:17:10
|
LL | type E = _::AssocTy;
Expand Down Expand Up @@ -122,7 +122,7 @@ error[E0223]: ambiguous associated type
LL | type I = ty!()::AssocTy;
| ^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<u8 as Trait>::AssocTy`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
--> $DIR/bad-assoc-ty.rs:49:13
|
LL | fn foo<X: K<_, _>>(x: X) {}
Expand All @@ -135,7 +135,7 @@ help: use type parameters instead
LL | fn foo<X: K<T, T>, T>(x: X) {}
| ^ ^ ^^^

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
--> $DIR/bad-assoc-ty.rs:52:34
|
LL | fn bar<F>(_: F) where F: Fn() -> _ {}
Expand All @@ -146,7 +146,7 @@ help: use type parameters instead
LL | fn bar<F, T>(_: F) where F: Fn() -> T {}
| ^^^ ^

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
--> $DIR/bad-assoc-ty.rs:55:19
|
LL | fn baz<F: Fn() -> _>(_: F) {}
Expand All @@ -157,7 +157,7 @@ help: use type parameters instead
LL | fn baz<F: Fn() -> T, T>(_: F) {}
| ^^^^

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs
--> $DIR/bad-assoc-ty.rs:58:33
|
LL | struct L<F>(F) where F: Fn() -> _;
Expand All @@ -168,7 +168,7 @@ help: use type parameters instead
LL | struct L<F, T>(F) where F: Fn() -> T;
| ^^^ ^

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs
--> $DIR/bad-assoc-ty.rs:60:30
|
LL | struct M<F> where F: Fn() -> _ {
Expand All @@ -179,7 +179,7 @@ help: use type parameters instead
LL | struct M<F, T> where F: Fn() -> T {
| ^^^ ^

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for enums
--> $DIR/bad-assoc-ty.rs:64:28
|
LL | enum N<F> where F: Fn() -> _ {
Expand All @@ -190,7 +190,7 @@ help: use type parameters instead
LL | enum N<F, T> where F: Fn() -> T {
| ^^^ ^

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for unions
--> $DIR/bad-assoc-ty.rs:69:29
|
LL | union O<F> where F: Fn() -> _ {
Expand All @@ -201,7 +201,7 @@ help: use type parameters instead
LL | union O<F, T> where F: Fn() -> T {
| ^^^ ^

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for traits
--> $DIR/bad-assoc-ty.rs:74:29
|
LL | trait P<F> where F: Fn() -> _ {
Expand All @@ -212,7 +212,7 @@ help: use type parameters instead
LL | trait P<F, T> where F: Fn() -> T {
| ^^^ ^

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
--> $DIR/bad-assoc-ty.rs:79:38
|
LL | fn foo<F>(_: F) where F: Fn() -> _ {}
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/error-codes/E0121.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/E0121.rs:1:13
|
LL | fn foo() -> _ { 5 }
Expand All @@ -7,7 +7,7 @@ LL | fn foo() -> _ { 5 }
| not allowed in type signatures
| help: replace with the correct return type: `i32`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
--> $DIR/E0121.rs:3:13
|
LL | static BAR: _ = "test";
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/fn/issue-80179.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ fn returns_i32() -> i32 {
}

fn returns_fn_ptr() -> _ {
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures [E0121]
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types [E0121]
//~| NOTE not allowed in type signatures
//~| HELP replace with the correct return type
//~| SUGGESTION fn() -> i32
returns_i32
}

fn returns_closure() -> _ {
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures [E0121]
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types [E0121]
//~| NOTE not allowed in type signatures
//~| HELP consider using an `Fn`, `FnMut`, or `FnOnce` trait bound
//~| NOTE for more information on `Fn` traits and closure types, see
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/fn/issue-80179.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/issue-80179.rs:10:24
|
LL | fn returns_fn_ptr() -> _ {
Expand All @@ -7,7 +7,7 @@ LL | fn returns_fn_ptr() -> _ {
| not allowed in type signatures
| help: replace with the correct return type: `fn() -> i32`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/issue-80179.rs:18:25
|
LL | fn returns_closure() -> _ {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-69396-const-no-type-in-macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ macro_rules! suite {
const A = "A".$fn();
//~^ ERROR the name `A` is defined multiple times
//~| ERROR missing type for `const` item
//~| ERROR the type placeholder `_` is not allowed within types
//~| ERROR the type placeholder `_` is not allowed within types on item signatures for constants
)*
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ error: missing type for `const` item
--> $DIR/issue-69396-const-no-type-in-macro.rs:4:19
|
LL | const A = "A".$fn();
| ^ help: provide a type for the item: `A: usize`
| ^ help: provide a type for the constant: `A: usize`
...
LL | / suite! {
LL | | len;
Expand All @@ -30,7 +30,7 @@ LL | | }
|
= note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
--> $DIR/issue-69396-const-no-type-in-macro.rs:4:19
|
LL | const A = "A".$fn();
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/self/self-infer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
struct S;

impl S {
fn f(self: _) {} //~ERROR the type placeholder `_` is not allowed within types on item sig
fn g(self: &_) {} //~ERROR the type placeholder `_` is not allowed within types on item sig
fn f(self: _) {} //~ERROR the type placeholder `_` is not allowed within types on item signatures for functions
fn g(self: &_) {} //~ERROR the type placeholder `_` is not allowed within types on item signatures for functions
}

fn main() {}
4 changes: 2 additions & 2 deletions src/test/ui/self/self-infer.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
--> $DIR/self-infer.rs:4:16
|
LL | fn f(self: _) {}
Expand All @@ -9,7 +9,7 @@ help: use type parameters instead
LL | fn f<T>(self: T) {}
| ^^^ ^

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
--> $DIR/self-infer.rs:5:17
|
LL | fn g(self: &_) {}
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/suggestions/const-no-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ static mut SM2 = "abc";

const C = 42;
//~^ ERROR missing type for `const` item
//~| HELP provide a type for the item
//~| HELP provide a type for the constant
//~| SUGGESTION C: i32

const D = &&42;
//~^ ERROR missing type for `const` item
//~| HELP provide a type for the item
//~| HELP provide a type for the constant
//~| SUGGESTION D: &&i32

static S = Vec::<String>::new();
//~^ ERROR missing type for `static` item
//~| HELP provide a type for the item
//~| HELP provide a type for the static variable
//~| SUGGESTION S: Vec<String>

static mut SM = "abc";
//~^ ERROR missing type for `static mut` item
//~| HELP provide a type for the item
//~| HELP provide a type for the static variable
//~| SUGGESTION &str
8 changes: 4 additions & 4 deletions src/test/ui/suggestions/const-no-type.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ error: missing type for `const` item
--> $DIR/const-no-type.rs:33:7
|
LL | const C = 42;
| ^ help: provide a type for the item: `C: i32`
| ^ help: provide a type for the constant: `C: i32`

error: missing type for `const` item
--> $DIR/const-no-type.rs:38:7
|
LL | const D = &&42;
| ^ help: provide a type for the item: `D: &&i32`
| ^ help: provide a type for the constant: `D: &&i32`

error: missing type for `static` item
--> $DIR/const-no-type.rs:43:8
|
LL | static S = Vec::<String>::new();
| ^ help: provide a type for the item: `S: Vec<String>`
| ^ help: provide a type for the static variable: `S: Vec<String>`

error: missing type for `static mut` item
--> $DIR/const-no-type.rs:48:12
|
LL | static mut SM = "abc";
| ^^ help: provide a type for the item: `SM: &str`
| ^^ help: provide a type for the static variable: `SM: &str`

error: missing type for `const` item
--> $DIR/const-no-type.rs:14:7
Expand Down
10 changes: 5 additions & 5 deletions src/test/ui/suggestions/unnamable-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@

const A = 5;
//~^ ERROR: missing type for `const` item
//~| HELP: provide a type for the item
//~| HELP: provide a type for the constant

static B: _ = "abc";
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures for static variables
//~| NOTE: not allowed in type signatures
//~| HELP: replace with the correct type


// FIXME: this should also suggest a function pointer, as the closure is non-capturing
const C: _ = || 42;
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures for constants
//~| NOTE: not allowed in type signatures
//~| NOTE: however, the inferred type

Expand All @@ -28,10 +28,10 @@ const D = S { t: { let i = 0; move || -> i32 { i } } };
fn foo() -> i32 { 42 }
const E = foo;
//~^ ERROR: missing type for `const` item
//~| HELP: provide a type for the item
//~| HELP: provide a type for the constant
const F = S { t: foo };
//~^ ERROR: missing type for `const` item
//~| HELP: provide a type for the item
//~| HELP: provide a type for the constant


const G = || -> i32 { yield 0; return 1; };
Expand Down
10 changes: 5 additions & 5 deletions src/test/ui/suggestions/unnamable-types.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ error: missing type for `const` item
--> $DIR/unnamable-types.rs:6:7
|
LL | const A = 5;
| ^ help: provide a type for the item: `A: i32`
| ^ help: provide a type for the constant: `A: i32`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
--> $DIR/unnamable-types.rs:10:11
|
LL | static B: _ = "abc";
Expand All @@ -13,7 +13,7 @@ LL | static B: _ = "abc";
| not allowed in type signatures
| help: replace with the correct type: `&str`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
--> $DIR/unnamable-types.rs:17:10
|
LL | const C: _ = || 42;
Expand Down Expand Up @@ -41,13 +41,13 @@ error: missing type for `const` item
--> $DIR/unnamable-types.rs:29:7
|
LL | const E = foo;
| ^ help: provide a type for the item: `E: fn() -> i32`
| ^ help: provide a type for the constant: `E: fn() -> i32`

error: missing type for `const` item
--> $DIR/unnamable-types.rs:32:7
|
LL | const F = S { t: foo };
| ^ help: provide a type for the item: `F: S<fn() -> i32>`
| ^ help: provide a type for the constant: `F: S<fn() -> i32>`

error: missing type for `const` item
--> $DIR/unnamable-types.rs:37:7
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/typeck/issue-74086.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fn main() {
static BUG: fn(_) -> u8 = |_| 8;
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures [E0121]
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions [E0121]
}
2 changes: 1 addition & 1 deletion src/test/ui/typeck/issue-74086.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
--> $DIR/issue-74086.rs:2:20
|
LL | static BUG: fn(_) -> u8 = |_| 8;
Expand Down
Loading

0 comments on commit 9b6c7ff

Please sign in to comment.