-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
glob imports ignore private items #23157
Comments
This is currently intentional, there is specific code in resolve to reject any imports of private items. The reason for this is that if an import itself is considered a private item the semantics get really weird very quickly. For example, all modules import the prelude, so can I import |
That seems reasonable in general, but I think the rule ought to be that globs only import accessible items, rather than public items, so that if a module imports a glob and has access to a private item it is still imported. I kind of see the argument for weirdness - but nothing that doesn't apply to Since there are no cycles in the 'can access private member' graph, it doesn't seem like it should make a difference wrt cyclicity. |
P-high, not 1.0. |
Updating the code on the example: struct Foo;
mod sub {
use super::*;
type Bar = Foo; // Error: use of undeclared type name Foo
} |
@jseyfried Does #35894 fix this? |
@brson Yeah, once |
Depends on #35120. |
The test would not compile with 1.13 due to this bug: rust-lang/rust#23157
This is a bug if the importing module should be able to see the private items. E.g.,
I think there is a backwards compatibility hazard here, because if there is already an item called
Foo
insub
then we currently get no error, but we ought to get a name clash (unless we allow shadowing in this case).triage: I-nominated
The text was updated successfully, but these errors were encountered: