about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Sullivan <sully@msully.net>2013-07-08 17:28:36 -0700
committerMichael Sullivan <sully@msully.net>2013-07-11 15:51:09 -0700
commit2b89b437fb38a4388d8f868f13d1200a22157e8a (patch)
tree04b4c5ac16c231436f56ed19b55bbaa45df98afa
parent82ae2fa93abbdf2b7437e9a8df4b4a18df0bf310 (diff)
downloadrust-2b89b437fb38a4388d8f868f13d1200a22157e8a.tar.gz
rust-2b89b437fb38a4388d8f868f13d1200a22157e8a.zip
Normalize self types for monomorphization.
-rw-r--r--src/librustc/middle/trans/callee.rs2
-rw-r--r--src/librustc/middle/trans/monomorphize.rs18
2 files changed, 11 insertions, 9 deletions
diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs
index 9b286adf8e9..948d3481fa0 100644
--- a/src/librustc/middle/trans/callee.rs
+++ b/src/librustc/middle/trans/callee.rs
@@ -250,7 +250,7 @@ pub fn trans_fn_ref_with_vtables(
         def_id: ast::def_id,   // def id of fn
         ref_id: ast::node_id,  // node id of use of fn; may be zero if N/A
         type_params: &[ty::t], // values for fn's ty params
-        vtables: Option<typeck::vtable_res>)
+        vtables: Option<typeck::vtable_res>) // vtables for the call
      -> FnData {
     //!
     //
diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs
index bbcf68c386d..ebc4bfa5cd5 100644
--- a/src/librustc/middle/trans/monomorphize.rs
+++ b/src/librustc/middle/trans/monomorphize.rs
@@ -63,24 +63,26 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
     assert!(real_substs.tps.iter().all(|t| !ty::type_needs_infer(*t)));
     let _icx = push_ctxt("monomorphic_fn");
     let mut must_cast = false;
-    let substs = real_substs.tps.iter().transform(|t| {
+
+    let do_normalize = |t: &ty::t| {
         match normalize_for_monomorphization(ccx.tcx, *t) {
           Some(t) => { must_cast = true; t }
           None => *t
         }
-    }).collect::<~[ty::t]>();
-
-    for real_substs.tps.iter().advance |s| { assert!(!ty::type_has_params(*s)); }
-    for substs.iter().advance |s| { assert!(!ty::type_has_params(*s)); }
-    let param_uses = type_use::type_uses_for(ccx, fn_id, substs.len());
+    };
 
     let psubsts = @param_substs {
-        tys: substs,
+        tys: real_substs.tps.map(|x| do_normalize(x)),
         vtables: vtables,
-        self_ty: real_substs.self_ty,
+        self_ty: real_substs.self_ty.map(|x| do_normalize(x)),
         self_vtable: self_vtable
     };
 
+    for real_substs.tps.iter().advance |s| { assert!(!ty::type_has_params(*s)); }
+    for psubsts.tys.iter().advance |s| { assert!(!ty::type_has_params(*s)); }
+    let param_uses = type_use::type_uses_for(ccx, fn_id, psubsts.tys.len());
+
+
     let hash_id = make_mono_id(ccx, fn_id, impl_did_opt,
                                &*psubsts,
                                Some(param_uses));