rustc: Instantiate trait refs for automatically-derived implementations. Should fix check-fast. rs=bustage

This commit is contained in:
Patrick Walton 2012-10-30 11:19:15 -07:00
parent b7872fa13e
commit 675c272dad
2 changed files with 18 additions and 5 deletions

View File

@ -556,6 +556,9 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Serializer,
}
let add_to_index = |copy ebml_w| add_to_index_(item, ebml_w, index);
debug!("encoding info for item at %s",
syntax::codemap::span_to_str(item.span, ecx.tcx.sess.codemap));
match item.node {
item_const(_, _) => {
add_to_index();
@ -738,7 +741,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Serializer,
}
}
do opt_trait.iter() |associated_trait| {
encode_trait_ref(ebml_w, ecx, *associated_trait)
encode_trait_ref(ebml_w, ecx, *associated_trait);
}
encode_path(ecx, ebml_w, path, ast_map::path_name(item.ident));
ebml_w.end_tag();

View File

@ -522,10 +522,20 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
region_param: rp,
ty: selfty});
for ms_opt.each |ms| {
let cms = convert_methods(ccx, *ms, rp, i_bounds);
for trait_ref.each |t| {
check_methods_against_trait(ccx, tps, rp, selfty, *t, cms);
match ms_opt {
Some(ref ms) => {
let cms = convert_methods(ccx, *ms, rp, i_bounds);
for trait_ref.each |t| {
check_methods_against_trait(ccx, tps, rp, selfty, *t,
cms);
}
}
None => {
// We still need to instantiate the trait ref here so that
// metadata encoding will find the type.
for trait_ref.each |trait_ref| {
let _ = instantiate_trait_ref(ccx, *trait_ref, rp);
}
}
}
}