Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a regression test for ICE of bad_placeholder_type #81509

Merged
merged 1 commit into from
Jan 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/test/ui/typeck/typeck_type_placeholder_item_help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ const TEST2: _ = 42u32;
const TEST3: _ = Some(42);
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures

trait Test4 {
const TEST4: _ = 42;
const TEST4: fn() -> _ = 42;
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures

trait Test5 {
const TEST5: _ = 42;
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
}

struct Test5;
struct Test6;

impl Test5 {
const TEST5: _ = 13;
impl Test6 {
const TEST6: _ = 13;
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
}

Expand Down
19 changes: 14 additions & 5 deletions src/test/ui/typeck/typeck_type_placeholder_item_help.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,32 @@ LL | const TEST3: _ = Some(42);
| help: replace `_` with the correct type: `Option<i32>`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item_help.rs:14:18
--> $DIR/typeck_type_placeholder_item_help.rs:13:22
|
LL | const TEST4: _ = 42;
LL | const TEST4: fn() -> _ = 42;
| ^
| |
| not allowed in type signatures
| help: use type parameters instead: `T`
Comment on lines +31 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing, but we should maybe file a ticket for the inaccurate suggestion.


error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item_help.rs:17:18
|
LL | const TEST5: _ = 42;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item_help.rs:21:18
--> $DIR/typeck_type_placeholder_item_help.rs:24:18
|
LL | const TEST5: _ = 13;
LL | const TEST6: _ = 13;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`

error: aborting due to 5 previous errors
error: aborting due to 6 previous errors

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