vis.is_accessible_from(self.current_module.normal_ancestor_id, self)
}
+ fn is_accessible_from(&self, vis: ty::Visibility, module: Module<'a>) -> bool {
+ vis.is_accessible_from(module.normal_ancestor_id, self)
+ }
+
fn report_privacy_errors(&self) {
if self.privacy_errors.len() == 0 { return }
let mut reported_spans = FnvHashSet();
};
// Define `binding` in `module`s glob importers.
- if binding.vis == ty::Visibility::Public {
- for directive in module.glob_importers.borrow_mut().iter() {
+ for directive in module.glob_importers.borrow_mut().iter() {
+ if match self.new_import_semantics {
+ true => self.is_accessible_from(binding.vis, directive.parent),
+ false => binding.vis == ty::Visibility::Public,
+ } {
let imported_binding = self.import(binding, directive);
let _ = self.try_define(directive.parent, name, ns, imported_binding);
}
resolution.borrow().binding().map(|binding| (*name, binding))
}).collect::<Vec<_>>();
for ((name, ns), binding) in bindings {
- if binding.pseudo_vis() == ty::Visibility::Public {
+ if binding.pseudo_vis() == ty::Visibility::Public ||
+ self.new_import_semantics && self.is_accessible(binding.vis) {
let imported_binding = self.import(binding, directive);
let _ = self.try_define(directive.parent, name, ns, imported_binding);
}
mod a {
pub use super::foo; //~ ERROR cannot be reexported
+ pub use super::*; //~ ERROR must import something with the glob's visibility
}
}
pub use super::foo; // This is OK since the value `foo` is visible enough.
fn f(_: foo::S) {} // `foo` is imported in the type namespace (but not `pub` reexported).
}
+
+ pub mod b {
+ pub use super::*; // This is also OK since the value `foo` is visible enough.
+ fn f(_: foo::S) {} // Again, the module `foo` is imported (but not `pub` reexported).
+ }
}
mod c {
// Test that `foo` is not reexported.
use b::a::foo::S; //~ ERROR `foo`
+ use b::b::foo::S as T; //~ ERROR `foo`
}
fn main() {}