-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
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`C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.P-mediumMedium priorityMedium priorityT-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.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
Seems to originate from #145827.
Test code:
mod m1 {
const _MAX_FMTVER_X1X_EVENTNUM: i32 = 0;
}
mod m2 {
fn fun(rough: i32) {}
}
Gives bizarre suggestion:
help: you might have meant to pattern match on the similarly named constant `_MAX_FMTVER_X1X_EVENTNUM`
|
6 - fn fun(rough: i32) {}
6 + fn fun(m1::_MAX_FMTVER_X1X_EVENTNUM: i32) {}
Which is then applied by cargo fix:
warning: failed to automatically apply fixes suggested by rustc to crate `lol`
...
The following errors were reported:
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `m1`
--> src/lib.rs:6:12
|
6 | fn fun(m1::_MAX_FMTVER_X1X_EVENTNUM: i32) {}
| ^^ use of unresolved module or unlinked crate `m1`
|
= help: if you wanted to use a crate named `m1`, use `cargo add m1` to add it to your `Cargo.toml`
help: consider importing this module
|
6 + use crate::m1;
rustc 1.92.0-nightly (5c7ae0c7e 2025-10-02)
This is a regression from stable to nightly.
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`C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.P-mediumMedium priorityMedium priorityT-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.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.