-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I tried this code:
trait Tr {
const A: &u32;
}I expected to see this happen: Compilation failure with reasonable diagnosis
Instead, this happened: The compiler suggested adding <'a> before trait, which is syntactically invalid.
error[E0106]: missing lifetime specifier
--> src/lib.rs:2:14
|
2 | const A: &u32;
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
1 | <'a>trait Tr {
2 | const A: &'a u32;
|
error: aborting due to previous error
Meta
rustc --version --verbose:
rustc 1.46.0-nightly (0c03aee8b 2020-07-05)
binary: rustc
commit-hash: 0c03aee8b81185d65b5821518661c30ecdb42de5
commit-date: 2020-07-05
host: x86_64-apple-darwin
release: 1.46.0-nightly
LLVM version: 10.0
smmalis37 and MSxDOS
Metadata
Metadata
Assignees
Labels
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.