-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Invalid suggestion on missing lifetime in impl trait associated type #68904
Copy link
Copy link
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.
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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Trying to elide lifetimes in an associated type of an impl trait causes rustc to emit some suggestions that contain invalid Rust syntax.
I tried this code:
I expected to see this happen: an error is emitted, possibly with a suggestion of adding a generic lifetime parameter.
Instead, this happened: the suggestion contains invalid Rust syntax, where the lifetime appears as if the parameter type was the generic parameter list:
rustc --version --verbose:
rustc 1.43.0-nightly (58b8343 2020-02-05)
binary: rustc
commit-hash: 58b8343
commit-date: 2020-02-05
host: x86_64-unknown-linux-gnu
release: 1.43.0-nightly
LLVM version: 9.0