Skip to content

Commit 2b7437b

Browse files
committed
---
yaml --- r: 29916 b: refs/heads/incoming c: 26aaf08 h: refs/heads/master v: v3
1 parent 5266787 commit 2b7437b

File tree

6 files changed

+6
-187
lines changed

6 files changed

+6
-187
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: 10c997a746178085b6b447a76e237dd08c5446fa
9+
refs/heads/incoming: 26aaf08ff4238b9117440f8717ab33a45ee45d4e
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/rustc/driver/driver.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
177177
let { def_map: def_map,
178178
exp_map: exp_map,
179179
exp_map2: exp_map2,
180-
impl_map: impl_map,
181180
trait_map: trait_map } =
182181
time(time_passes, ~"resolution", ||
183182
middle::resolve3::resolve_crate(sess, lang_items, crate));
@@ -232,9 +231,10 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
232231
if upto == cu_no_trans { return {crate: crate, tcx: some(ty_cx)}; }
233232
let outputs = option::get(outputs);
234233

235-
let maps = {mutbl_map: mutbl_map, root_map: root_map,
234+
let maps = {mutbl_map: mutbl_map,
235+
root_map: root_map,
236236
last_use_map: last_use_map,
237-
impl_map: impl_map, method_map: method_map,
237+
method_map: method_map,
238238
vtable_map: vtable_map};
239239

240240
let (llmod, link_meta) = time(time_passes, ~"translation", ||

branches/incoming/src/rustc/metadata/encoder.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ type encode_parms = {
4646
reachable: hashmap<ast::node_id, ()>,
4747
reexports: ~[(~str, def_id)],
4848
reexports2: middle::resolve3::ExportMap2,
49-
impl_map: fn@(ast::node_id) -> ~[(ident, def_id)],
5049
item_symbols: hashmap<ast::node_id, ~str>,
5150
discrim_symbols: hashmap<ast::node_id, ~str>,
5251
link_meta: link_meta,
@@ -60,7 +59,6 @@ enum encode_ctxt = {
6059
reachable: hashmap<ast::node_id, ()>,
6160
reexports: ~[(~str, def_id)],
6261
reexports2: middle::resolve3::ExportMap2,
63-
impl_map: fn@(ast::node_id) -> ~[(ident, def_id)],
6462
item_symbols: hashmap<ast::node_id, ~str>,
6563
discrim_symbols: hashmap<ast::node_id, ~str>,
6664
link_meta: link_meta,
@@ -1049,7 +1047,6 @@ fn encode_metadata(parms: encode_parms, crate: @crate) -> ~[u8] {
10491047
reachable: parms.reachable,
10501048
reexports: parms.reexports,
10511049
reexports2: parms.reexports2,
1052-
impl_map: parms.impl_map,
10531050
item_symbols: parms.item_symbols,
10541051
discrim_symbols: parms.discrim_symbols,
10551052
link_meta: parms.link_meta,

branches/incoming/src/rustc/middle/astencode.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ type maps = {
5050
mutbl_map: middle::borrowck::mutbl_map,
5151
root_map: middle::borrowck::root_map,
5252
last_use_map: middle::liveness::last_use_map,
53-
impl_map: middle::resolve3::ImplMap,
5453
method_map: middle::typeck::method_map,
5554
vtable_map: middle::typeck::vtable_map,
5655
};
@@ -727,9 +726,6 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
727726
}
728727
}
729728

730-
// impl_map is not used except when emitting metadata,
731-
// don't need to keep it.
732-
733729
do option::iter(maps.method_map.find(id)) |mme| {
734730
do ebml_w.tag(c::tag_table_method_map) {
735731
ebml_w.id(id);

branches/incoming/src/rustc/middle/resolve3.rs

Lines changed: 2 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ type MethodInfo = {
8484
};
8585

8686
type Impl = { did: def_id, ident: ident, methods: ~[@MethodInfo] };
87-
type ImplScope = @~[@Impl];
88-
type ImplScopes = @list<ImplScope>;
89-
type ImplMap = hashmap<node_id,ImplScopes>;
9087

9188
// Trait method resolution
9289
type TraitMap = @hashmap<node_id,@DVec<def_id>>;
@@ -452,9 +449,6 @@ struct Module {
452449
// The index of the import we're resolving.
453450
let mut resolved_import_count: uint;
454451

455-
// The list of implementation scopes, rooted from this module.
456-
let mut impl_scopes: ImplScopes;
457-
458452
new(parent_link: ParentLink, def_id: option<def_id>) {
459453
self.parent_link = parent_link;
460454
self.def_id = def_id;
@@ -469,8 +463,6 @@ struct Module {
469463
self.import_resolutions = atom_hashmap();
470464
self.glob_count = 0u;
471465
self.resolved_import_count = 0u;
472-
473-
self.impl_scopes = @nil;
474466
}
475467

476468
fn all_imports_resolved() -> bool {
@@ -708,7 +700,6 @@ struct Resolver {
708700
let namespaces: ~[Namespace];
709701

710702
let def_map: DefMap;
711-
let impl_map: ImplMap;
712703
let export_map: ExportMap;
713704
let export_map2: ExportMap2;
714705
let trait_map: TraitMap;
@@ -749,7 +740,6 @@ struct Resolver {
749740
self.namespaces = ~[ ModuleNS, TypeNS, ValueNS, ImplNS ];
750741

751742
self.def_map = int_hash();
752-
self.impl_map = int_hash();
753743
self.export_map = int_hash();
754744
self.export_map2 = int_hash();
755745
self.trait_map = @int_hash();
@@ -766,9 +756,6 @@ struct Resolver {
766756
self.record_exports();
767757
self.session.abort_if_errors();
768758

769-
self.build_impl_scopes();
770-
self.session.abort_if_errors();
771-
772759
self.resolve_crate();
773760
self.session.abort_if_errors();
774761

@@ -2809,106 +2796,6 @@ struct Resolver {
28092796
}
28102797
}
28112798

2812-
// Implementation scope creation
2813-
//
2814-
// This is a fairly simple pass that simply gathers up all the typeclass
2815-
// implementations in scope and threads a series of singly-linked series
2816-
// of impls through the tree.
2817-
2818-
fn build_impl_scopes() {
2819-
let root_module = (*self.graph_root).get_module();
2820-
self.build_impl_scopes_for_module_subtree(root_module);
2821-
}
2822-
2823-
fn build_impl_scopes_for_module_subtree(module_: @Module) {
2824-
// If this isn't a local crate, then bail out. We don't need to
2825-
// resolve implementations for external crates.
2826-
2827-
match module_.def_id {
2828-
some(def_id) if def_id.crate == local_crate => {
2829-
// OK. Continue.
2830-
}
2831-
none => {
2832-
// Resolve implementation scopes for the root module.
2833-
}
2834-
some(_) => {
2835-
// Bail out.
2836-
debug!{"(building impl scopes for module subtree) not \
2837-
resolving implementations for `%s`",
2838-
self.module_to_str(module_)};
2839-
return;
2840-
}
2841-
}
2842-
2843-
self.build_impl_scope_for_module(module_);
2844-
2845-
for module_.children.each |_atom, child_name_bindings| {
2846-
match (*child_name_bindings).get_module_if_available() {
2847-
none => {
2848-
// Nothing to do.
2849-
}
2850-
some(child_module) => {
2851-
self.build_impl_scopes_for_module_subtree(child_module);
2852-
}
2853-
}
2854-
}
2855-
2856-
for module_.anonymous_children.each |_node_id, child_module| {
2857-
self.build_impl_scopes_for_module_subtree(child_module);
2858-
}
2859-
}
2860-
2861-
fn build_impl_scope_for_module(module_: @Module) {
2862-
let mut impl_scope = ~[];
2863-
2864-
debug!{"(building impl scope for module) processing module %s (%?)",
2865-
self.module_to_str(module_),
2866-
copy module_.def_id};
2867-
2868-
// Gather up all direct children implementations in the module.
2869-
for module_.children.each |_impl_name, child_name_bindings| {
2870-
if child_name_bindings.impl_defs.len() >= 1u {
2871-
impl_scope += child_name_bindings.impl_defs;
2872-
}
2873-
}
2874-
2875-
debug!{"(building impl scope for module) found %u impl(s) as direct \
2876-
children",
2877-
impl_scope.len()};
2878-
2879-
// Gather up all imports.
2880-
for module_.import_resolutions.each |_impl_name, import_resolution| {
2881-
for (*import_resolution.impl_target).each |impl_target| {
2882-
debug!{"(building impl scope for module) found impl def"};
2883-
impl_scope += impl_target.bindings.impl_defs;
2884-
}
2885-
}
2886-
2887-
debug!{"(building impl scope for module) found %u impl(s) in total",
2888-
impl_scope.len()};
2889-
2890-
// Determine the parent's implementation scope.
2891-
let mut parent_impl_scopes;
2892-
match module_.parent_link {
2893-
NoParentLink => {
2894-
parent_impl_scopes = @nil;
2895-
}
2896-
ModuleParentLink(parent_module_node, _) |
2897-
BlockParentLink(parent_module_node, _) => {
2898-
parent_impl_scopes = parent_module_node.impl_scopes;
2899-
}
2900-
}
2901-
2902-
// Create the new implementation scope, if it was nonempty, and chain
2903-
// it up to the parent.
2904-
2905-
if impl_scope.len() >= 1u {
2906-
module_.impl_scopes = @cons(@impl_scope, parent_impl_scopes);
2907-
} else {
2908-
module_.impl_scopes = parent_impl_scopes;
2909-
}
2910-
}
2911-
29122799
// AST resolution
29132800
//
29142801
// We maintain a list of value ribs and type ribs.
@@ -3095,11 +2982,6 @@ struct Resolver {
30952982
fn resolve_crate() unsafe {
30962983
debug!{"(resolving crate) starting"};
30972984

3098-
// To avoid a failure in metadata encoding later, we have to add the
3099-
// crate-level implementation scopes
3100-
3101-
self.impl_map.insert(0, (*self.graph_root).get_module().impl_scopes);
3102-
31032985
// XXX: This is awful!
31042986
let this = ptr::addr_of(self);
31052987
visit_crate(*self.crate, (), mk_vt(@{
@@ -3669,8 +3551,6 @@ struct Resolver {
36693551

36703552
// Write the implementations in scope into the module metadata.
36713553
debug!{"(resolving module) resolving module ID %d", id};
3672-
self.impl_map.insert(id, self.current_module.impl_scopes);
3673-
36743554
visit_mod(module_, span, id, (), visitor);
36753555
}
36763556

@@ -4385,13 +4265,8 @@ struct Resolver {
43854265
}
43864266

43874267
fn resolve_expr(expr: @expr, visitor: ResolveVisitor) {
4388-
// First, write the implementations in scope into a table if the
4389-
// expression might need them.
4390-
4391-
self.record_impls_for_expr_if_necessary(expr);
4392-
4393-
// Then record candidate traits for this expression if it could result
4394-
// in the invocation of a method call.
4268+
// First, record candidate traits for this expression if it could
4269+
// result in the invocation of a method call.
43954270

43964271
self.record_candidate_traits_for_expr_if_necessary(expr);
43974272

@@ -4506,19 +4381,6 @@ struct Resolver {
45064381
}
45074382
}
45084383

4509-
fn record_impls_for_expr_if_necessary(expr: @expr) {
4510-
match expr.node {
4511-
expr_field(*) | expr_path(*) | expr_cast(*) | expr_binary(*) |
4512-
expr_unary(*) | expr_assign_op(*) | expr_index(*) => {
4513-
self.impl_map.insert(expr.id,
4514-
self.current_module.impl_scopes);
4515-
}
4516-
_ => {
4517-
// Nothing to do.
4518-
}
4519-
}
4520-
}
4521-
45224384
fn record_candidate_traits_for_expr_if_necessary(expr: @expr) {
45234385
match expr.node {
45244386
expr_field(_, ident, _) => {
@@ -4855,38 +4717,13 @@ struct Resolver {
48554717
module_repr, value_repr, type_repr, impl_repr};
48564718
}
48574719
}
4858-
4859-
fn dump_impl_scopes(impl_scopes: ImplScopes) {
4860-
debug!{"Dump of impl scopes:"};
4861-
4862-
let mut i = 0u;
4863-
let mut impl_scopes = impl_scopes;
4864-
loop {
4865-
match *impl_scopes {
4866-
cons(impl_scope, rest_impl_scopes) => {
4867-
debug!{"Impl scope %u:", i};
4868-
4869-
for (*impl_scope).each |implementation| {
4870-
debug!{"Impl: %s", *implementation.ident};
4871-
}
4872-
4873-
i += 1u;
4874-
impl_scopes = rest_impl_scopes;
4875-
}
4876-
nil => {
4877-
break;
4878-
}
4879-
}
4880-
}
4881-
}
48824720
}
48834721

48844722
/// Entry point to crate resolution.
48854723
fn resolve_crate(session: session, lang_items: LanguageItems, crate: @crate)
48864724
-> { def_map: DefMap,
48874725
exp_map: ExportMap,
48884726
exp_map2: ExportMap2,
4889-
impl_map: ImplMap,
48904727
trait_map: TraitMap } {
48914728

48924729
let resolver = @Resolver(session, lang_items, crate);
@@ -4895,7 +4732,6 @@ fn resolve_crate(session: session, lang_items: LanguageItems, crate: @crate)
48954732
def_map: resolver.def_map,
48964733
exp_map: resolver.export_map,
48974734
exp_map2: resolver.export_map2,
4898-
impl_map: resolver.impl_map,
48994735
trait_map: resolver.trait_map
49004736
};
49014737
}

branches/incoming/src/rustc/middle/trans/base.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5645,7 +5645,6 @@ fn crate_ctxt_to_encode_parms(cx: @crate_ctxt)
56455645
reachable: cx.reachable,
56465646
reexports: reexports(cx),
56475647
reexports2: cx.exp_map2,
5648-
impl_map: |a| impl_map(cx, a),
56495648
item_symbols: cx.item_symbols,
56505649
discrim_symbols: cx.discrim_symbols,
56515650
link_meta: cx.link_meta,
@@ -5669,15 +5668,6 @@ fn crate_ctxt_to_encode_parms(cx: @crate_ctxt)
56695668
}
56705669
return reexports;
56715670
}
5672-
5673-
fn impl_map(cx: @crate_ctxt,
5674-
id: ast::node_id) -> ~[(ast::ident, ast::def_id)] {
5675-
let mut result = ~[];
5676-
for list::each(cx.maps.impl_map.get(id)) |impls| {
5677-
vec::push_all(result, (*impls).map(|i| (i.ident, i.did)));
5678-
}
5679-
return result;
5680-
}
56815671
}
56825672

56835673
fn write_metadata(cx: @crate_ctxt, crate: @ast::crate) {

0 commit comments

Comments
 (0)