-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed
Labels
A-cfgArea: `cfg` conditional compilationArea: `cfg` conditional compilationA-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-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.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.
Description
Given the following code, I would've expected rustc to mention the cfg'ed out item Struct:
#[cfg(flag)]
struct Struct;
fn main() { let _ = Struct; } //~ ERROR cannot find type `Struct` in this scopebut it doesn't:
error[E0425]: cannot find value `Struct` in this scope
--> file.rs:4:21
|
4 | fn main() { let _ = Struct; }
| ^^^^^^ not found in this scope
Only if you slightly tweak the input by replacing the simple path Struct with a complex one like self::Struct or crate::Struct, the note "found an item that was configured out" will show up:
#[cfg(flag)]
struct Struct;
fn main() { let _ = self::Struct; }error[E0425]: cannot find value `Struct` in module `self`
--> file.rs:4:27
|
4 | fn main() { let _ = self::Struct; }
| ^^^^^^ not found in `self`
|
note: found an item that was configured out
--> file.rs:2:8
|
2 | struct Struct;
| ^^^^^^
note: the item is gated here
--> file.rs:1:1
|
1 | #[cfg(flag)]
| ^^^^^^^^^^^^
CC #109005. I don't know if that's intentional or not.
Metadata
Metadata
Assignees
Labels
A-cfgArea: `cfg` conditional compilationArea: `cfg` conditional compilationA-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-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.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.