-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
"introduce a type parameter with a trait bound instead of using impl Trait" diagnostic is malformed for async fns where the previous parameter is a borrow #79843
Copy link
Copy link
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`AsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.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.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`AsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.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.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Done
(Edit: Actually, being an inherent fn doesn't matter. It happens with top-level fns too.)
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=bc52a6f5c708462abbd91b4dd7d9b1ba
This prints the diagnostic:
The suggestion in the last line is not valid syntax (
_: &,). It also emits malformed syntax if the first parameter is a&selfor&mut selfparameter.The diagnostic becomes well-formed if any of the following is done:
The first parameter is changed to
_: ()instead of_: &()The fn is not an async fn.
In either case, the diagnostic correctly says:
Meta
Happens on both nightly:
... and stable: