Incorrect suggestion when trying to write to an immutable field in an async function #93093
Labels
A-async-await
Area: Async & Await
A-borrow-checker
Area: The borrow checker
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
AsyncAwait-Polish
Async-await issues that are part of the "polish" area
AsyncAwait-Triaged
Async-await issues that have been triaged during a working group meeting.
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=df6e36b97b73bd3e3ea0fdfe9325b1c9
The current output is:
Ideally the output should look like:
&mut S
is not a valid argument; it needs to be either&mut self
orsome_name: &mut S
. For some reason this problem only happens when the function is async.The text was updated successfully, but these errors were encountered: