-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Crate name found in --extern gets suggested verbatim on unresolved import #113035
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-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-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-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.
Given the code in file
user.rsas shown below:rustc outputs the following when invoked via
rustc user.rs --crate-type=lib --edition=2021 --extern=a-great-crate=liba_great_crate.rlib:While ideally, in this specific case it should either suggest nothing of if feasible suggest changing the
--externflag to--extern=a_great_crate=liba_great_crate.rlib(the latter is probably P-low). I did actually get confused by the suggestion when I originally faced it.In fact, rustc suggests whatever garbage you put in the flag (e.g. on
rustc … '--extern=a&-gre?t#crate=xxx'). In these cases it shouldn't consider the name at all (I realize though that this might be a case of garbage in, garbage out).@rustbot label T-compiler A-diagnostics A-suggestion-diagnostics D-invalid-suggestion