Skip to content

Commit cf136cd

Browse files
committed
Use the erase_regions helper within trans in deference to
`ty_fold::erase_regions`; also erase regions whenever we normalize associated types.
1 parent bdc1bfd commit cf136cd

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/librustc_trans/trans/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ pub fn fulfill_obligation<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
992992
let tcx = ccx.tcx();
993993

994994
// Remove any references to regions; this helps improve caching.
995-
let trait_ref = ty_fold::erase_regions(tcx, trait_ref);
995+
let trait_ref = erase_regions(tcx, &trait_ref);
996996

997997
// First check the cache.
998998
match ccx.trait_cache().borrow().get(&trait_ref) {

src/librustc_trans/trans/monomorphize.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,10 @@ pub fn normalize_associated_type<'tcx,T>(tcx: &ty::ctxt<'tcx>, value: &T) -> T
315315
{
316316
debug!("normalize_associated_type(t={})", value.repr(tcx));
317317

318+
let value = erase_regions(tcx, value);
319+
318320
if !value.has_projection_types() {
319-
return value.clone();
321+
return value;
320322
}
321323

322324
// FIXME(#20304) -- cache
@@ -326,7 +328,7 @@ pub fn normalize_associated_type<'tcx,T>(tcx: &ty::ctxt<'tcx>, value: &T) -> T
326328
let mut selcx = traits::SelectionContext::new(&infcx, &typer);
327329
let cause = traits::ObligationCause::dummy();
328330
let traits::Normalized { value: result, obligations } =
329-
traits::normalize(&mut selcx, cause, value);
331+
traits::normalize(&mut selcx, cause, &value);
330332

331333
debug!("normalize_associated_type: result={} obligations={}",
332334
result.repr(tcx),

0 commit comments

Comments
 (0)