Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upglob imports ignore private items #23157
Comments
rust-highfive
added
the
I-nominated
label
Mar 8, 2015
rust-highfive
added this to the 1.0 beta milestone
Mar 8, 2015
nrc
added
A-resolve
A-globs
labels
Mar 8, 2015
nrc
removed this from the 1.0 beta milestone
Mar 8, 2015
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
P-high, not 1.0. |
pnkfelix
added
P-medium
and removed
I-nominated
labels
Mar 12, 2015
This comment has been minimized.
This comment has been minimized.
|
Updating the code on the example: struct Foo;
mod sub {
use super::*;
type Bar = Foo; // Error: use of undeclared type name Foo
} |
This comment has been minimized.
This comment has been minimized.
|
@jseyfried Does #35894 fix this? |
brson
added
I-wrong
T-compiler
E-hard
labels
Aug 25, 2016
This comment has been minimized.
This comment has been minimized.
|
@brson Yeah, once |
This comment has been minimized.
This comment has been minimized.
|
Depends on #35120. |
nrc commentedMar 8, 2015
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
Fooinsubthen we currently get no error, but we ought to get a name clash (unless we allow shadowing in this case).triage: I-nominated