Skip to content

Commit d79c6d8

Browse files
committed
---
yaml --- r: 24060 b: refs/heads/master c: 348d07f h: refs/heads/master v: v3
1 parent 80caee6 commit d79c6d8

File tree

7 files changed

+22
-80
lines changed

7 files changed

+22
-80
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 69aaa410ca2ec499e79939aa44552192f443b44b
2+
refs/heads/master: 348d07f099561992d37d8e0107b9440cae021615
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/rustc/driver/driver.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
201201
middle::lang_items::collect_language_items(crate, sess));
202202

203203
let { def_map: def_map,
204-
exp_map: exp_map,
205204
exp_map2: exp_map2,
206205
trait_map: trait_map } =
207206
time(time_passes, ~"resolution", ||
@@ -266,7 +265,7 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
266265
let (llmod, link_meta) = time(time_passes, ~"translation", ||
267266
trans::base::trans_crate(sess, crate, ty_cx,
268267
&outputs.obj_filename,
269-
exp_map, exp_map2, maps));
268+
exp_map2, maps));
270269

271270
time(time_passes, ~"LLVM passes", ||
272271
link::write::run_passes(sess, llmod,

trunk/src/rustc/metadata/encoder.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ type encode_parms = {
4747
diag: span_handler,
4848
tcx: ty::ctxt,
4949
reachable: HashMap<ast::node_id, ()>,
50-
reexports: ~[(~str, def_id)],
5150
reexports2: middle::resolve::ExportMap2,
5251
item_symbols: HashMap<ast::node_id, ~str>,
5352
discrim_symbols: HashMap<ast::node_id, ~str>,
@@ -73,7 +72,6 @@ enum encode_ctxt = {
7372
tcx: ty::ctxt,
7473
stats: stats,
7574
reachable: HashMap<ast::node_id, ()>,
76-
reexports: ~[(~str, def_id)],
7775
reexports2: middle::resolve::ExportMap2,
7876
item_symbols: HashMap<ast::node_id, ~str>,
7977
discrim_symbols: HashMap<ast::node_id, ~str>,
@@ -1108,7 +1106,6 @@ fn encode_metadata(parms: encode_parms, crate: @crate) -> ~[u8] {
11081106
tcx: parms.tcx,
11091107
stats: move stats,
11101108
reachable: parms.reachable,
1111-
reexports: parms.reexports,
11121109
reexports2: parms.reexports2,
11131110
item_symbols: parms.item_symbols,
11141111
discrim_symbols: parms.discrim_symbols,

trunk/src/rustc/middle/resolve.rs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ type Impl = { did: def_id, ident: ident, methods: ~[@MethodInfo] };
9191
// Trait method resolution
9292
type TraitMap = @HashMap<node_id,@DVec<def_id>>;
9393

94-
// Export mapping
95-
type Export = { reexp: bool, id: def_id };
96-
type ExportMap = HashMap<node_id, ~[Export]>;
97-
9894
// This is the replacement export map. It maps a module to all of the exports
9995
// within.
10096
type ExportMap2 = HashMap<node_id, ~[Export2]>;
@@ -775,7 +771,6 @@ fn Resolver(session: session, lang_items: LanguageItems,
775771
namespaces: ~[ ModuleNS, TypeNS, ValueNS ],
776772

777773
def_map: HashMap(),
778-
export_map: HashMap(),
779774
export_map2: HashMap(),
780775
trait_map: @HashMap(),
781776

@@ -833,7 +828,6 @@ struct Resolver {
833828
namespaces: ~[Namespace],
834829

835830
def_map: DefMap,
836-
export_map: ExportMap,
837831
export_map2: ExportMap2,
838832
trait_map: TraitMap,
839833
}
@@ -2880,8 +2874,7 @@ impl Resolver {
28802874

28812875
fn record_exports_for_module(module_: @Module) {
28822876
let mut exports2 = ~[];
2883-
for module_.exported_names.each |name, node_id| {
2884-
let mut exports = ~[];
2877+
for module_.exported_names.each |name, _exp_node_id| {
28852878
for self.namespaces.each |namespace| {
28862879
match self.resolve_definition_of_name_in_module(module_,
28872880
name,
@@ -2895,10 +2888,6 @@ impl Resolver {
28952888
for %?",
28962889
self.session.str_of(name),
28972890
module_.def_id);
2898-
vec::push(exports, {
2899-
reexp: false,
2900-
id: def_id_of_def(target_def)
2901-
});
29022891
vec::push(exports2, Export2 {
29032892
reexport: false,
29042893
name: self.session.str_of(name),
@@ -2910,10 +2899,6 @@ impl Resolver {
29102899
%?",
29112900
self.session.str_of(name),
29122901
module_.def_id);
2913-
vec::push(exports, {
2914-
reexp: true,
2915-
id: def_id_of_def(target_def)
2916-
});
29172902
vec::push(exports2, Export2 {
29182903
reexport: true,
29192904
name: self.session.str_of(name),
@@ -2922,8 +2907,6 @@ impl Resolver {
29222907
}
29232908
}
29242909
}
2925-
2926-
self.export_map.insert(node_id, exports);
29272910
}
29282911

29292912
match copy module_.def_id {
@@ -4914,15 +4897,13 @@ impl Resolver {
49144897
/// Entry point to crate resolution.
49154898
fn resolve_crate(session: session, lang_items: LanguageItems, crate: @crate)
49164899
-> { def_map: DefMap,
4917-
exp_map: ExportMap,
49184900
exp_map2: ExportMap2,
49194901
trait_map: TraitMap } {
49204902

49214903
let resolver = @Resolver(session, lang_items, crate);
49224904
resolver.resolve(resolver);
49234905
return {
49244906
def_map: resolver.def_map,
4925-
exp_map: resolver.export_map,
49264907
exp_map2: resolver.export_map2,
49274908
trait_map: resolver.trait_map
49284909
};

trunk/src/rustc/middle/trans/base.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2504,31 +2504,13 @@ fn crate_ctxt_to_encode_parms(cx: @crate_ctxt)
25042504
diag: cx.sess.diagnostic(),
25052505
tcx: cx.tcx,
25062506
reachable: cx.reachable,
2507-
reexports: reexports(cx),
25082507
reexports2: cx.exp_map2,
25092508
item_symbols: cx.item_symbols,
25102509
discrim_symbols: cx.discrim_symbols,
25112510
link_meta: cx.link_meta,
25122511
cstore: cx.sess.cstore,
25132512
encode_inlined_item: encode_inlined_item
25142513
};
2515-
2516-
fn reexports(cx: @crate_ctxt) -> ~[(~str, ast::def_id)] {
2517-
let mut reexports = ~[];
2518-
for cx.exp_map.each |exp_id, defs| {
2519-
for defs.each |def| {
2520-
if !def.reexp { loop; }
2521-
let path = match cx.tcx.items.get(exp_id) {
2522-
ast_map::node_export(_, path) => {
2523-
ast_map::path_to_str(*path, cx.sess.parse_sess.interner)
2524-
}
2525-
_ => fail ~"reexports"
2526-
};
2527-
vec::push(reexports, (path, def.id));
2528-
}
2529-
}
2530-
return reexports;
2531-
}
25322514
}
25332515

25342516
fn write_metadata(cx: @crate_ctxt, crate: @ast::crate) {
@@ -2564,15 +2546,14 @@ fn trans_crate(sess: session::session,
25642546
crate: @ast::crate,
25652547
tcx: ty::ctxt,
25662548
output: &Path,
2567-
emap: resolve::ExportMap,
25682549
emap2: resolve::ExportMap2,
25692550
maps: astencode::maps)
25702551
-> (ModuleRef, link_meta) {
25712552

25722553
let symbol_hasher = @hash::default_state();
25732554
let link_meta =
25742555
link::build_link_meta(sess, *crate, output, symbol_hasher);
2575-
let reachable = reachable::find_reachable(crate.node.module, emap, tcx,
2556+
let reachable = reachable::find_reachable(crate.node.module, emap2, tcx,
25762557
maps.method_map);
25772558

25782559
// Append ".rc" to crate name as LLVM module identifier.
@@ -2626,7 +2607,6 @@ fn trans_crate(sess: session::session,
26262607
externs: HashMap::<~str,ValueRef>(),
26272608
intrinsics: intrinsics,
26282609
item_vals: HashMap::<int,ValueRef>(),
2629-
exp_map: emap,
26302610
exp_map2: emap2,
26312611
reachable: reachable,
26322612
item_symbols: HashMap::<int,~str>(),

trunk/src/rustc/middle/trans/common.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ type crate_ctxt = {
117117
externs: HashMap<~str, ValueRef>,
118118
intrinsics: HashMap<~str, ValueRef>,
119119
item_vals: HashMap<ast::node_id, ValueRef>,
120-
exp_map: resolve::ExportMap,
121120
exp_map2: resolve::ExportMap2,
122121
reachable: reachable::map,
123122
item_symbols: HashMap<ast::node_id, ~str>,

trunk/src/rustc/middle/trans/reachable.rs

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,47 +17,33 @@ export map, find_reachable;
1717

1818
type map = std::map::HashMap<node_id, ()>;
1919

20-
type ctx = {exp_map: resolve::ExportMap,
20+
type ctx = {exp_map2: resolve::ExportMap2,
2121
tcx: ty::ctxt,
2222
method_map: typeck::method_map,
2323
rmap: map};
2424

25-
fn find_reachable(crate_mod: _mod, exp_map: resolve::ExportMap,
25+
fn find_reachable(crate_mod: _mod, exp_map2: resolve::ExportMap2,
2626
tcx: ty::ctxt, method_map: typeck::method_map) -> map {
2727
let rmap = std::map::HashMap();
28-
let cx = {exp_map: exp_map, tcx: tcx, method_map: method_map, rmap: rmap};
29-
traverse_public_mod(cx, crate_mod);
28+
let cx = {exp_map2: exp_map2, tcx: tcx,
29+
method_map: method_map, rmap: rmap};
30+
traverse_public_mod(cx, ast::crate_node_id, crate_mod);
3031
traverse_all_resources_and_impls(cx, crate_mod);
3132
rmap
3233
}
3334

34-
fn traverse_exports(cx: ctx, vis: ~[@view_item]) -> bool {
35+
fn traverse_exports(cx: ctx, mod_id: node_id) -> bool {
3536
let mut found_export = false;
36-
for vec::each(vis) |vi| {
37-
match vi.node {
38-
view_item_export(vps) => {
37+
match cx.exp_map2.find(mod_id) {
38+
Some(exp2s) => {
39+
for exp2s.each |e2| {
3940
found_export = true;
40-
for vec::each(vps) |vp| {
41-
match vp.node {
42-
view_path_simple(_, _, _, id) | view_path_glob(_, id) |
43-
view_path_list(_, _, id) => {
44-
traverse_export(cx, id);
45-
}
46-
}
47-
}
48-
}
49-
_ => ()
50-
}
51-
}
52-
found_export
53-
}
54-
55-
fn traverse_export(cx: ctx, exp_id: node_id) {
56-
do option::iter(cx.exp_map.find(exp_id)) |defs| {
57-
for vec::each(defs) |def| {
58-
traverse_def_id(cx, def.id);
59-
}
41+
traverse_def_id(cx, e2.def_id)
42+
};
43+
}
44+
None => ()
6045
}
46+
return found_export;
6147
}
6248

6349
fn traverse_def_id(cx: ctx, did: def_id) {
@@ -81,8 +67,8 @@ fn traverse_def_id(cx: ctx, did: def_id) {
8167
}
8268
}
8369

84-
fn traverse_public_mod(cx: ctx, m: _mod) {
85-
if !traverse_exports(cx, m.view_items) {
70+
fn traverse_public_mod(cx: ctx, mod_id: node_id, m: _mod) {
71+
if !traverse_exports(cx, mod_id) {
8672
// No exports, so every local item is exported
8773
for vec::each(m.items) |item| {
8874
traverse_public_item(cx, *item);
@@ -94,9 +80,9 @@ fn traverse_public_item(cx: ctx, item: @item) {
9480
if cx.rmap.contains_key(item.id) { return; }
9581
cx.rmap.insert(item.id, ());
9682
match item.node {
97-
item_mod(m) => traverse_public_mod(cx, m),
83+
item_mod(m) => traverse_public_mod(cx, item.id, m),
9884
item_foreign_mod(nm) => {
99-
if !traverse_exports(cx, nm.view_items) {
85+
if !traverse_exports(cx, item.id) {
10086
for vec::each(nm.items) |item| {
10187
cx.rmap.insert(item.id, ());
10288
}

0 commit comments

Comments
 (0)