"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
Labels
A-async-await
Area: Async & Await
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
AsyncAwait-Triaged
Async-await issues that have been triaged during a working group meeting.
C-bug
Category: This is a bug.
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
E-help-wanted
Call for participation: Help is requested to fix this issue.
E-medium
Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
(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&self
or&mut self
parameter.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:
The text was updated successfully, but these errors were encountered: