Import suggestion breaks #[cfg]
attribute for previous imports
#115618
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`.
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.
Code
Current output
Desired output
Rationale and extra context
After applying the suggestion, you end up with this code:
Note that the
cfg(unix)
attribute is at the wrong place, so code won't compile on Windows anymore.I'd say the ideal solution is to either:
Other cases
No response
Anything else?
Comes from rust-lang/rust-enhanced#516 (Sublime Text's "extension" for Rust).
The extension relies on
rustc
's import suggestions to apply fixes (user is prompted), accepting the fix breaks your code.Useful label:
D-invalid-suggestion
The text was updated successfully, but these errors were encountered: