-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
suggestion/fix (use ::item) is incorrect for editions 2018+ #141082
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code
Current output
Desired output
Rationale and extra context
use ::nuonly works in the 2015 edition.use crate::nuworks in the 2015 and newer editionsOther cases
Rust Version
Anything else?
Found this issue while running a compiler UI test on the 2018 edition.
As the UI test has the
run-rustfixdirective, it will use therustfixcrate to apply the suggestions in the compiler output. As the suggestion is wrong for edition 2018+, the output ofrustfixdoes not compile as indicate the output of thexcommand.What I found curious there is that the JSON version of the diagnostic indicates that the suggestion "may be incorrect", yet
rustfix(as invoked by thecompiletesttool) still applies the "maybe incorrect" suggestion.