Import suggestion at incorrect line when first line is a struct attribute #69733
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
C-bug
Category: This is a bug.
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.
I tried this code:
(From rust-lang/rust-analyzer#3237 (comment))
in foo.rs,
in lib.rs
and
in Cargo.toml
And ran
cargo check --message-format=json
I expected to see this happen:
A suggestion to place the imports on line 1, e.g.
"line_start": 1, "line_end": 1, "suggested_replacement": "use proc_macro::Ident;"
Instead, this happened:
One of the above in a more readable format:
Note that
line_start
andline_end
are 2, so the use statement is inserted in between thederive
attribute and the structSymbol
, which causes a compilation error.Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: