Skip to content

Remove _ from E0121 diagnostic suggestions #86058

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

Merged
merged 1 commit into from
Jun 7, 2021
Merged
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
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/collect/type_of.rs
Original file line number Diff line number Diff line change
@@ -766,7 +766,7 @@ fn infer_placeholder_type(
if !ty.references_error() {
diag.span_suggestion(
span,
"replace `_` with the correct type",
"replace with the correct type",
ty.to_string(),
Applicability::MaybeIncorrect,
);
2 changes: 1 addition & 1 deletion src/test/ui/error-codes/E0121.stderr
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ LL | static BAR: _ = "test";
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `&str`
| help: replace with the correct type: `&str`

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ LL | const A = "A".$fn();
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `bool`
| help: replace with the correct type: `bool`
...
LL | / suite! {
LL | | len;
16 changes: 8 additions & 8 deletions src/test/ui/typeck/typeck_type_placeholder_item.full_tait.stderr
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ LL | static TEST3: _ = "test";
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `&str`
| help: replace with the correct type: `&str`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item.rs:19:15
@@ -88,7 +88,7 @@ LL | static TEST4: _ = 145;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`
| 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.rs:22:15
@@ -210,7 +210,7 @@ LL | static B: _ = 42;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`
| 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.rs:80:15
@@ -244,7 +244,7 @@ LL | static FN_TEST3: _ = "test";
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `&str`
| help: replace with the correct type: `&str`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item.rs:92:22
@@ -253,7 +253,7 @@ LL | static FN_TEST4: _ = 145;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`
| 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.rs:95:22
@@ -435,7 +435,7 @@ LL | const _: Option<_> = map(value);
| ^^^^^^^^^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `Option<u8>`
| help: replace with the correct type: `Option<u8>`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item.rs:144:31
@@ -526,7 +526,7 @@ LL | const D: _ = 42;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`
| 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.rs:201:26
@@ -639,7 +639,7 @@ LL | const D: _ = 42;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`
| help: replace with the correct type: `i32`

error: aborting due to 69 previous errors; 1 warning emitted

16 changes: 8 additions & 8 deletions src/test/ui/typeck/typeck_type_placeholder_item.min_tait.stderr
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ LL | static TEST3: _ = "test";
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `&str`
| help: replace with the correct type: `&str`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item.rs:19:15
@@ -79,7 +79,7 @@ LL | static TEST4: _ = 145;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`
| 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.rs:22:15
@@ -201,7 +201,7 @@ LL | static B: _ = 42;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`
| 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.rs:80:15
@@ -235,7 +235,7 @@ LL | static FN_TEST3: _ = "test";
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `&str`
| help: replace with the correct type: `&str`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item.rs:92:22
@@ -244,7 +244,7 @@ LL | static FN_TEST4: _ = 145;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`
| 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.rs:95:22
@@ -426,7 +426,7 @@ LL | const _: Option<_> = map(value);
| ^^^^^^^^^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `Option<u8>`
| help: replace with the correct type: `Option<u8>`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item.rs:144:31
@@ -517,7 +517,7 @@ LL | const D: _ = 42;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`
| 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.rs:201:26
@@ -630,7 +630,7 @@ LL | const D: _ = 42;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`
| help: replace with the correct type: `i32`

error: aborting due to 69 previous errors

8 changes: 4 additions & 4 deletions src/test/ui/typeck/typeck_type_placeholder_item_help.stderr
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ LL | const TEST2: _ = 42u32;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `u32`
| help: replace with the correct type: `u32`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item_help.rs:10:14
@@ -23,7 +23,7 @@ LL | const TEST3: _ = Some(42);
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `Option<i32>`
| 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:13:22
@@ -38,7 +38,7 @@ LL | const TEST5: _ = 42;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`
| 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:24:18
@@ -47,7 +47,7 @@ LL | const TEST6: _ = 13;
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`
| help: replace with the correct type: `i32`

error: aborting due to 6 previous errors