-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Cannot refer to item inside function from module inside function #79260
Copy link
Copy link
Open
Labels
A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.Category: This is a bug.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.Category: This is a bug.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code (https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=8c1861ee7e07799c5897f37f0aa2f849):
This fails to compile:
rustc --version --verbose:Also reproduces on current nightly (as of 2020-11-21).
I suspect that what's going on is that
use super::*doesn't actually resolve to the scope insidefn main, but instead the surrounding scopefn mainis itself in.I tried to search around other issues to find whether this is expected.
This is a super weird special case. It seems plausible (at least to me) that
use super::*from a module inside a function should bring other items local to that function into scope.