Use the erase_regions
helper within trans in deference to
`ty_fold::erase_regions`; also erase regions whenever we normalize associated types.
This commit is contained in:
parent
bdc1bfd8f1
commit
cf136cd350
@ -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) {
|
||||
|
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user