about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2015-01-07 14:04:37 -0500
committerNiko Matsakis <niko@alum.mit.edu>2015-01-07 14:07:58 -0500
commitcf136cd3507a5e929cff8d03179c0f6d96bdb687 (patch)
tree7213560792c25c170546fbe7a43f37c19e48aa6a
parentbdc1bfd8f1740461d2ee39ba41f5245ed8913a2a (diff)
downloadrust-cf136cd3507a5e929cff8d03179c0f6d96bdb687.tar.gz
rust-cf136cd3507a5e929cff8d03179c0f6d96bdb687.zip
Use the `erase_regions` helper within trans in deference to
`ty_fold::erase_regions`; also erase regions whenever we normalize
associated types.
-rw-r--r--src/librustc_trans/trans/common.rs2
-rw-r--r--src/librustc_trans/trans/monomorphize.rs6
2 files changed, 5 insertions, 3 deletions
diff --git a/src/librustc_trans/trans/common.rs b/src/librustc_trans/trans/common.rs
index bdec9ad378b..017593f387e 100644
--- a/src/librustc_trans/trans/common.rs
+++ b/src/librustc_trans/trans/common.rs
@@ -992,7 +992,7 @@ pub fn fulfill_obligation<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
 let tcx = ccx.tcx();
 
 // Remove any references to regions; this helps improve caching.
-let trait_ref = ty_fold::erase_regions(tcx, trait_ref);
+let trait_ref = erase_regions(tcx, &trait_ref);
 
 // First check the cache.
 match ccx.trait_cache().borrow().get(&trait_ref) {
diff --git a/src/librustc_trans/trans/monomorphize.rs b/src/librustc_trans/trans/monomorphize.rs
index e2594765f4f..a35bae07da0 100644
--- a/src/librustc_trans/trans/monomorphize.rs
+++ b/src/librustc_trans/trans/monomorphize.rs
@@ -315,8 +315,10 @@ pub fn normalize_associated_type<'tcx,T>(tcx: &ty::ctxt<'tcx>, value: &T) -> T
 {
     debug!("normalize_associated_type(t={})", value.repr(tcx));
 
+    let value = erase_regions(tcx, value);
+
     if !value.has_projection_types() {
-        return value.clone();
+        return value;
     }
 
     // FIXME(#20304) -- cache
@@ -326,7 +328,7 @@ pub fn normalize_associated_type<'tcx,T>(tcx: &ty::ctxt<'tcx>, value: &T) -> T
     let mut selcx = traits::SelectionContext::new(&infcx, &typer);
     let cause = traits::ObligationCause::dummy();
     let traits::Normalized { value: result, obligations } =
-        traits::normalize(&mut selcx, cause, value);
+        traits::normalize(&mut selcx, cause, &value);
 
     debug!("normalize_associated_type: result={} obligations={}",
            result.repr(tcx),