Skip to content

Commit c74f004

Browse files
Rollup merge of #81509 - 0yoyoyo:fix-issue-72685-ice-drop-in-place, r=estebank
Add a regression test for ICE of bad_placeholder_type Add a regression test for #72685. Check the error message is output instead of ICE.
2 parents 4de3181 + 81ed4cf commit c74f004

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

src/test/ui/typeck/typeck_type_placeholder_item_help.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,18 @@ const TEST2: _ = 42u32;
1010
const TEST3: _ = Some(42);
1111
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
1212

13-
trait Test4 {
14-
const TEST4: _ = 42;
13+
const TEST4: fn() -> _ = 42;
14+
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
15+
16+
trait Test5 {
17+
const TEST5: _ = 42;
1518
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
1619
}
1720

18-
struct Test5;
21+
struct Test6;
1922

20-
impl Test5 {
21-
const TEST5: _ = 13;
23+
impl Test6 {
24+
const TEST6: _ = 13;
2225
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
2326
}
2427

src/test/ui/typeck/typeck_type_placeholder_item_help.stderr

+14-5
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,32 @@ LL | const TEST3: _ = Some(42);
2626
| help: replace `_` with the correct type: `Option<i32>`
2727

2828
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
29-
--> $DIR/typeck_type_placeholder_item_help.rs:14:18
29+
--> $DIR/typeck_type_placeholder_item_help.rs:13:22
3030
|
31-
LL | const TEST4: _ = 42;
31+
LL | const TEST4: fn() -> _ = 42;
32+
| ^
33+
| |
34+
| not allowed in type signatures
35+
| help: use type parameters instead: `T`
36+
37+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
38+
--> $DIR/typeck_type_placeholder_item_help.rs:17:18
39+
|
40+
LL | const TEST5: _ = 42;
3241
| ^
3342
| |
3443
| not allowed in type signatures
3544
| help: replace `_` with the correct type: `i32`
3645

3746
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
38-
--> $DIR/typeck_type_placeholder_item_help.rs:21:18
47+
--> $DIR/typeck_type_placeholder_item_help.rs:24:18
3948
|
40-
LL | const TEST5: _ = 13;
49+
LL | const TEST6: _ = 13;
4150
| ^
4251
| |
4352
| not allowed in type signatures
4453
| help: replace `_` with the correct type: `i32`
4554

46-
error: aborting due to 5 previous errors
55+
error: aborting due to 6 previous errors
4756

4857
For more information about this error, try `rustc --explain E0121`.

0 commit comments

Comments
 (0)