Skip to content

Commit 10c997a

Browse files
committed
rustc: Get rid of the impl_map in the encoder
1 parent 1ed94a5 commit 10c997a

File tree

1 file changed

+20
-26
lines changed

1 file changed

+20
-26
lines changed

src/rustc/metadata/encoder.rs

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -262,32 +262,26 @@ fn encode_info_for_mod(ecx: @encode_ctxt, ebml_w: ebml::writer, md: _mod,
262262
encode_family(ebml_w, 'm');
263263
encode_name(ebml_w, name);
264264
debug!{"(encoding info for module) encoding info for module ID %d", id};
265-
// the impl map contains ref_ids
266-
let impls = ecx.impl_map(id);
267-
for impls.each |i| {
268-
let (ident, did) = i;
269-
debug!{"(encoding info for module) ... encoding impl %s (%?/%?), \
270-
exported? %?",
271-
*ident,
272-
did,
273-
ast_map::node_id_to_str(ecx.tcx.items, did.node),
274-
ast_util::is_exported(ident, md)};
275-
276-
ebml_w.start_tag(tag_mod_impl);
277-
match ecx.tcx.items.find(did.node) {
278-
some(ast_map::node_item(it@@{node: cl@item_class(*),_},_)) => {
279-
/* If did stands for a trait
280-
ref, we need to map it to its parent class */
281-
ebml_w.wr_str(def_to_str(local_def(it.id)));
282-
}
283-
_ => {
284-
// Must be a re-export, then!
285-
// ...or a trait ref
286-
ebml_w.wr_str(def_to_str(did));
287-
}
288-
};
289-
ebml_w.end_tag();
290-
} // for
265+
266+
// Encode info about all the module children.
267+
for md.items.each |item| {
268+
match item.node {
269+
item_impl(*) | item_class(*) => {
270+
let (ident, did) = (item.ident, item.id);
271+
debug!{"(encoding info for module) ... encoding impl %s \
272+
(%?/%?), exported? %?",
273+
*ident,
274+
did,
275+
ast_map::node_id_to_str(ecx.tcx.items, did),
276+
ast_util::is_exported(ident, md)};
277+
278+
ebml_w.start_tag(tag_mod_impl);
279+
ebml_w.wr_str(def_to_str(local_def(did)));
280+
ebml_w.end_tag();
281+
}
282+
_ => {} // XXX: Encode these too.
283+
}
284+
}
291285

292286
encode_path(ebml_w, path, ast_map::path_mod(name));
293287

0 commit comments

Comments
 (0)