Skip to content

Commit 1d69397

Browse files
committed
EmbargoVisitor::reexports isn't needed
1 parent 5092b09 commit 1d69397

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

src/librustc_privacy/lib.rs

+5-15
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,6 @@ struct EmbargoVisitor<'a, 'tcx: 'a> {
165165
// may jump across private boundaries through reexport statements or type aliases.
166166
exported_items: ExportedItems,
167167

168-
// This sets contains all the destination nodes which are publicly
169-
// re-exported. This is *not* a set of all reexported nodes, only a set of
170-
// all nodes which are reexported *and* reachable from external crates. This
171-
// means that the destination of the reexport is exported, and hence the
172-
// destination must also be exported.
173-
reexports: NodeSet,
174-
175168
// Items that are directly public without help of reexports or type aliases.
176169
// These two fields are closely related to one another in that they are only
177170
// 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> {
237230
_ => {
238231
self.prev_public = self.prev_public && item.vis == hir::Public;
239232
self.prev_exported = (self.prev_exported && item.vis == hir::Public) ||
240-
self.reexports.contains(&item.id);
233+
self.exported_items.contains(&item.id);
241234

242235
self.maybe_insert_id(item.id);
243236
}
@@ -347,7 +340,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
347340
for foreign_item in &foreign_mod.items {
348341
let public = self.prev_public && foreign_item.vis == hir::Public;
349342
let exported = (self.prev_exported && foreign_item.vis == hir::Public) ||
350-
self.reexports.contains(&foreign_item.id);
343+
self.exported_items.contains(&foreign_item.id);
351344

352345
if public {
353346
self.public_items.insert(foreign_item.id);
@@ -387,7 +380,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
387380
assert!(self.export_map.contains_key(&id), "wut {}", id);
388381
for export in self.export_map.get(&id).unwrap() {
389382
if let Some(node_id) = self.tcx.map.as_local_node_id(export.def_id) {
390-
self.reexports.insert(node_id);
383+
self.exported_items.insert(node_id);
391384
}
392385
}
393386
}
@@ -1532,17 +1525,14 @@ pub fn check_crate(tcx: &ty::ctxt,
15321525
tcx: tcx,
15331526
exported_items: NodeSet(),
15341527
public_items: NodeSet(),
1535-
reexports: NodeSet(),
15361528
export_map: export_map,
15371529
prev_exported: true,
15381530
prev_public: true,
15391531
};
15401532
loop {
1541-
let before = (visitor.exported_items.len(), visitor.public_items.len(),
1542-
visitor.reexports.len());
1533+
let before = (visitor.exported_items.len(), visitor.public_items.len());
15431534
visit::walk_crate(&mut visitor, krate);
1544-
let after = (visitor.exported_items.len(), visitor.public_items.len(),
1545-
visitor.reexports.len());
1535+
let after = (visitor.exported_items.len(), visitor.public_items.len());
15461536
if after == before {
15471537
break
15481538
}

0 commit comments

Comments
 (0)