You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tweak diagnostic for use suggestion to blank text surrounding span.
Our suggestion system is oriented around diff's to code, and in that
context, if your spans are perfect, everything works out. But our
spans are not always perfect, due to macros.
In the specific case of issue 87613, the #[tokio::main] attribute
macro works by rewriting an `async fn main` into an `fn main`, by just
removing the `async` token. The problem is that the `async` text
remains in the source code, and the span of the code rewritten by
suggestion system happily transcribes all the text on the line of that
`fn main` when generating a `use` suggestion, yielding the absurd
looking `async use std::process::Command;` suggestion.
This patch works around this whole problem by adding a way for
suggestions to indicate that their transcriptions should not include
the original source code; just its *whitespace*. This leads to a happy
place where the suggested line numbers are correct and the indentation
is usually also correct, while avoiding the `async use` output we
would see before.
0 commit comments