diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-10-30 11:19:15 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-10-30 11:21:01 -0700 |
| commit | 675c272dadc8cd7e529fda64904c87e8243fe94f (patch) | |
| tree | 2a17a8fa1f15c8344f525fb768e0ce822180a740 /src/rustc | |
| parent | b7872fa13eb561956455eefbb06a63411cb4ad14 (diff) | |
| download | rust-675c272dadc8cd7e529fda64904c87e8243fe94f.tar.gz rust-675c272dadc8cd7e529fda64904c87e8243fe94f.zip | |
rustc: Instantiate trait refs for automatically-derived implementations. Should fix check-fast. rs=bustage
Diffstat (limited to 'src/rustc')
| -rw-r--r-- | src/rustc/metadata/encoder.rs | 5 | ||||
| -rw-r--r-- | src/rustc/middle/typeck/collect.rs | 18 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index f0a9677ab2f..07fc637a049 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -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(); diff --git a/src/rustc/middle/typeck/collect.rs b/src/rustc/middle/typeck/collect.rs index 611edbb3236..ed0cd48504b 100644 --- a/src/rustc/middle/typeck/collect.rs +++ b/src/rustc/middle/typeck/collect.rs @@ -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); + } } } } |
