1
Fork 0

compiler: fold by value

This commit is contained in:
Bastian Kauschke 2020-10-24 02:21:18 +02:00
parent 3ec6720bf1
commit 2bf93bd852
140 changed files with 679 additions and 699 deletions

View file

@ -25,7 +25,7 @@ pub fn codegen_fulfill_obligation<'tcx>(
(param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>),
) -> Result<ImplSource<'tcx, ()>, ErrorReported> {
// Remove any references to regions; this helps improve caching.
let trait_ref = tcx.erase_regions(&trait_ref);
let trait_ref = tcx.erase_regions(trait_ref);
// We expect the input to be fully normalized.
debug_assert_eq!(trait_ref, tcx.normalize_erasing_regions(param_env, trait_ref));
debug!(
@ -89,7 +89,7 @@ pub fn codegen_fulfill_obligation<'tcx>(
debug!("fulfill_obligation: register_predicate_obligation {:?}", predicate);
fulfill_cx.register_predicate_obligation(&infcx, predicate);
});
let impl_source = drain_fulfillment_cx_or_panic(&infcx, &mut fulfill_cx, &impl_source);
let impl_source = drain_fulfillment_cx_or_panic(&infcx, &mut fulfill_cx, impl_source);
info!("Cache miss: {:?} => {:?}", trait_ref, impl_source);
Ok(impl_source)
@ -110,7 +110,7 @@ pub fn codegen_fulfill_obligation<'tcx>(
fn drain_fulfillment_cx_or_panic<T>(
infcx: &InferCtxt<'_, 'tcx>,
fulfill_cx: &mut FulfillmentContext<'tcx>,
result: &T,
result: T,
) -> T
where
T: TypeFoldable<'tcx>,
@ -128,5 +128,5 @@ where
}
let result = infcx.resolve_vars_if_possible(result);
infcx.tcx.erase_regions(&result)
infcx.tcx.erase_regions(result)
}