diff options
| -rw-r--r-- | src/librustc_privacy/lib.rs | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 119054759a2..491c8a2c452 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -165,13 +165,6 @@ struct EmbargoVisitor<'a, 'tcx: 'a> { // may jump across private boundaries through reexport statements or type aliases. exported_items: ExportedItems, - // This sets contains all the destination nodes which are publicly - // re-exported. This is *not* a set of all reexported nodes, only a set of - // all nodes which are reexported *and* reachable from external crates. This - // means that the destination of the reexport is exported, and hence the - // destination must also be exported. - reexports: NodeSet, - // Items that are directly public without help of reexports or type aliases. // These two fields are closely related to one another in that they are only // used for generation of the `public_items` set, not for privacy checking at @@ -237,7 +230,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> { _ => { self.prev_public = self.prev_public && item.vis == hir::Public; self.prev_exported = (self.prev_exported && item.vis == hir::Public) || - self.reexports.contains(&item.id); + self.exported_items.contains(&item.id); self.maybe_insert_id(item.id); } @@ -347,7 +340,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> { for foreign_item in &foreign_mod.items { let public = self.prev_public && foreign_item.vis == hir::Public; let exported = (self.prev_exported && foreign_item.vis == hir::Public) || - self.reexports.contains(&foreign_item.id); + self.exported_items.contains(&foreign_item.id); if public { self.public_items.insert(foreign_item.id); @@ -387,7 +380,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> { assert!(self.export_map.contains_key(&id), "wut {}", id); for export in self.export_map.get(&id).unwrap() { if let Some(node_id) = self.tcx.map.as_local_node_id(export.def_id) { - self.reexports.insert(node_id); + self.exported_items.insert(node_id); } } } @@ -1532,17 +1525,14 @@ pub fn check_crate(tcx: &ty::ctxt, tcx: tcx, exported_items: NodeSet(), public_items: NodeSet(), - reexports: NodeSet(), export_map: export_map, prev_exported: true, prev_public: true, }; loop { - let before = (visitor.exported_items.len(), visitor.public_items.len(), - visitor.reexports.len()); + let before = (visitor.exported_items.len(), visitor.public_items.len()); visit::walk_crate(&mut visitor, krate); - let after = (visitor.exported_items.len(), visitor.public_items.len(), - visitor.reexports.len()); + let after = (visitor.exported_items.len(), visitor.public_items.len()); if after == before { break } |
