normalize in codegen_fulfill_obligations

This commit is contained in:
Bastian Kauschke 2020-09-28 20:56:52 +02:00
parent 5296ac6565
commit 9c302f55bd

View File

@ -19,11 +19,11 @@ use rustc_middle::ty::{self, TyCtxt};
/// obligations *could be* resolved if we wanted to.
/// Assumes that this is run after the entire crate has been successfully type-checked.
pub fn codegen_fulfill_obligation<'tcx>(
ty: TyCtxt<'tcx>,
tcx: TyCtxt<'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 = ty.erase_regions(&trait_ref);
// Remove any references to regions and normalize; this helps improve caching.
let trait_ref = tcx.normalize_erasing_regions(param_env, trait_ref);
debug!(
"codegen_fulfill_obligation(trait_ref={:?}, def_id={:?})",
@ -33,7 +33,7 @@ pub fn codegen_fulfill_obligation<'tcx>(
// Do the initial selection for the obligation. This yields the
// shallow result we are looking for -- that is, what specific impl.
ty.infer_ctxt().enter(|infcx| {
tcx.infer_ctxt().enter(|infcx| {
let mut selcx = SelectionContext::new(&infcx);
let obligation_cause = ObligationCause::dummy();