Skip to content

Commit af0a872

Browse files
committed
rustc::middle::trans::reachable: remove some unneeded code
This was a remnant from the export list era.
1 parent 3fc0524 commit af0a872

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

src/librustc/middle/trans/reachable.rs

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,21 @@ pub fn find_reachable(crate_mod: &_mod, exp_map2: resolve::ExportMap2,
4949
method_map: method_map,
5050
rmap: &mut rmap
5151
};
52-
traverse_public_mod(cx, ast::crate_node_id, crate_mod);
52+
traverse_exports(cx, ast::crate_node_id);
5353
traverse_all_resources_and_impls(cx, crate_mod);
5454
}
5555
return @rmap;
5656
}
5757

58-
fn traverse_exports(cx: @mut ctx, mod_id: node_id) -> bool {
59-
let mut found_export = false;
58+
fn traverse_exports(cx: @mut ctx, mod_id: node_id) {
6059
match cx.exp_map2.find(&mod_id) {
6160
Some(ref exp2s) => {
6261
for (*exp2s).each |e2| {
63-
found_export = true;
6462
traverse_def_id(cx, e2.def_id)
6563
};
6664
}
6765
None => ()
6866
}
69-
return found_export;
7067
}
7168

7269
fn traverse_def_id(cx: @mut ctx, did: def_id) {
@@ -87,15 +84,6 @@ fn traverse_def_id(cx: @mut ctx, did: def_id) {
8784
}
8885
}
8986

90-
fn traverse_public_mod(cx: @mut ctx, mod_id: node_id, m: &_mod) {
91-
if !traverse_exports(cx, mod_id) {
92-
// No exports, so every local item is exported
93-
for m.items.each |item| {
94-
traverse_public_item(cx, *item);
95-
}
96-
}
97-
}
98-
9987
fn traverse_public_item(cx: @mut ctx, item: @item) {
10088
{
10189
// FIXME #6021: naming rmap shouldn't be necessary
@@ -106,15 +94,7 @@ fn traverse_public_item(cx: @mut ctx, item: @item) {
10694
}
10795

10896
match item.node {
109-
item_mod(ref m) => traverse_public_mod(cx, item.id, m),
110-
item_foreign_mod(ref nm) => {
111-
if !traverse_exports(cx, item.id) {
112-
for nm.items.each |item| {
113-
let cx = &mut *cx; // FIXME(#6269) reborrow @mut to &mut
114-
cx.rmap.insert(item.id);
115-
}
116-
}
117-
}
97+
item_mod(_) | item_foreign_mod(_) => traverse_exports(cx, item.id),
11898
item_fn(_, _, _, ref generics, ref blk) => {
11999
if generics.ty_params.len() > 0u ||
120100
attr::find_inline_attr(item.attrs) != attr::ia_none {

0 commit comments

Comments
 (0)