Skip to content

Commit 6d99f54

Browse files
committed
Updated tests to reflect specified types in E0121
1 parent 1f42e9d commit 6d99f54

29 files changed

+363
-366
lines changed

src/test/ui/did_you_mean/bad-assoc-ty.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type D = (u8, u8)::AssocTy;
1616

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

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

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

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

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

5858
struct L<F>(F) where F: Fn() -> _;
59-
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
59+
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for structs
6060
struct M<F> where F: Fn() -> _ {
61-
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
61+
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for structs
6262
a: F,
6363
}
6464
enum N<F> where F: Fn() -> _ {
65-
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
65+
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for enums
6666
Foo(F),
6767
}
6868

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

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

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

8383
fn main() {}

src/test/ui/did_you_mean/bad-assoc-ty.stderr

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ error[E0223]: ambiguous associated type
8181
LL | type D = (u8, u8)::AssocTy;
8282
| ^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(u8, u8) as Trait>::AssocTy`
8383

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

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

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

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

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

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

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

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

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

215-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
215+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
216216
--> $DIR/bad-assoc-ty.rs:79:38
217217
|
218218
LL | fn foo<F>(_: F) where F: Fn() -> _ {}

src/test/ui/error-codes/E0121.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
1+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
22
--> $DIR/E0121.rs:1:13
33
|
44
LL | fn foo() -> _ { 5 }
@@ -7,7 +7,7 @@ LL | fn foo() -> _ { 5 }
77
| not allowed in type signatures
88
| help: replace with the correct return type: `i32`
99

10-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
10+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
1111
--> $DIR/E0121.rs:3:13
1212
|
1313
LL | static BAR: _ = "test";

src/test/ui/fn/issue-80179.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ fn returns_i32() -> i32 {
88
}
99

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

1818
fn returns_closure() -> _ {
19-
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures [E0121]
19+
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types [E0121]
2020
//~| NOTE not allowed in type signatures
2121
//~| HELP consider using an `Fn`, `FnMut`, or `FnOnce` trait bound
2222
//~| NOTE for more information on `Fn` traits and closure types, see

src/test/ui/fn/issue-80179.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
1+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
22
--> $DIR/issue-80179.rs:10:24
33
|
44
LL | fn returns_fn_ptr() -> _ {
@@ -7,7 +7,7 @@ LL | fn returns_fn_ptr() -> _ {
77
| not allowed in type signatures
88
| help: replace with the correct return type: `fn() -> i32`
99

10-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
10+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
1111
--> $DIR/issue-80179.rs:18:25
1212
|
1313
LL | fn returns_closure() -> _ {

src/test/ui/issues/issue-69396-const-no-type-in-macro.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ macro_rules! suite {
44
const A = "A".$fn();
55
//~^ ERROR the name `A` is defined multiple times
66
//~| ERROR missing type for `const` item
7-
//~| ERROR the type placeholder `_` is not allowed within types
7+
//~| ERROR the type placeholder `_` is not allowed within types on item signatures for constants
88
)*
99
}
1010
}

src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ error: missing type for `const` item
2020
--> $DIR/issue-69396-const-no-type-in-macro.rs:4:19
2121
|
2222
LL | const A = "A".$fn();
23-
| ^ help: provide a type for the item: `A: usize`
23+
| ^ help: provide a type for the constant: `A: usize`
2424
...
2525
LL | / suite! {
2626
LL | | len;
@@ -30,7 +30,7 @@ LL | | }
3030
|
3131
= note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
3232

33-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
33+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
3434
--> $DIR/issue-69396-const-no-type-in-macro.rs:4:19
3535
|
3636
LL | const A = "A".$fn();

src/test/ui/self/self-infer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
struct S;
22

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

88
fn main() {}

src/test/ui/self/self-infer.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
1+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
22
--> $DIR/self-infer.rs:4:16
33
|
44
LL | fn f(self: _) {}
@@ -9,7 +9,7 @@ help: use type parameters instead
99
LL | fn f<T>(self: T) {}
1010
| ^^^ ^
1111

12-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
12+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
1313
--> $DIR/self-infer.rs:5:17
1414
|
1515
LL | fn g(self: &_) {}

src/test/ui/suggestions/const-no-type.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ static mut SM2 = "abc";
3232

3333
const C = 42;
3434
//~^ ERROR missing type for `const` item
35-
//~| HELP provide a type for the item
35+
//~| HELP provide a type for the constant
3636
//~| SUGGESTION C: i32
3737

3838
const D = &&42;
3939
//~^ ERROR missing type for `const` item
40-
//~| HELP provide a type for the item
40+
//~| HELP provide a type for the constant
4141
//~| SUGGESTION D: &&i32
4242

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

4848
static mut SM = "abc";
4949
//~^ ERROR missing type for `static mut` item
50-
//~| HELP provide a type for the item
50+
//~| HELP provide a type for the static variable
5151
//~| SUGGESTION &str

src/test/ui/suggestions/const-no-type.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@ error: missing type for `const` item
22
--> $DIR/const-no-type.rs:33:7
33
|
44
LL | const C = 42;
5-
| ^ help: provide a type for the item: `C: i32`
5+
| ^ help: provide a type for the constant: `C: i32`
66

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

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

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

2525
error: missing type for `const` item
2626
--> $DIR/const-no-type.rs:14:7

src/test/ui/suggestions/unnamable-types.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55

66
const A = 5;
77
//~^ ERROR: missing type for `const` item
8-
//~| HELP: provide a type for the item
8+
//~| HELP: provide a type for the constant
99

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

1515

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

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

3636

3737
const G = || -> i32 { yield 0; return 1; };

src/test/ui/suggestions/unnamable-types.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ error: missing type for `const` item
22
--> $DIR/unnamable-types.rs:6:7
33
|
44
LL | const A = 5;
5-
| ^ help: provide a type for the item: `A: i32`
5+
| ^ help: provide a type for the constant: `A: i32`
66

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

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

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

5252
error: missing type for `const` item
5353
--> $DIR/unnamable-types.rs:37:7

src/test/ui/typeck/issue-74086.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
fn main() {
22
static BUG: fn(_) -> u8 = |_| 8;
3-
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures [E0121]
3+
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions [E0121]
44
}

src/test/ui/typeck/issue-74086.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
1+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
22
--> $DIR/issue-74086.rs:2:20
33
|
44
LL | static BUG: fn(_) -> u8 = |_| 8;

0 commit comments

Comments
 (0)