X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_traits%2Fnormalize_erasing_regions.rs;h=e81b0242d6120bcf60cd689d5c23ac7e3d712d6a;hb=eb769ed6b09cb9fa007508caef808f5e50264cb0;hp=bfa1a80bb320fd248dc0ae807aff39d02cc57c8f;hpb=af561116516bd1d5ed4a830e08dc5e74293f78fb;p=rust.git diff --git a/src/librustc_traits/normalize_erasing_regions.rs b/src/librustc_traits/normalize_erasing_regions.rs index bfa1a80bb32..e81b0242d61 100644 --- a/src/librustc_traits/normalize_erasing_regions.rs +++ b/src/librustc_traits/normalize_erasing_regions.rs @@ -1,14 +1,11 @@ -use rustc::traits::{Normalized, ObligationCause}; use rustc::traits::query::NoSolution; +use rustc::traits::{Normalized, ObligationCause}; use rustc::ty::query::Providers; use rustc::ty::{self, ParamEnvAnd, Ty, TyCtxt}; use std::sync::atomic::Ordering; crate fn provide(p: &mut Providers<'_>) { - *p = Providers { - normalize_ty_after_erasing_regions, - ..*p - }; + *p = Providers { normalize_ty_after_erasing_regions, ..*p }; } fn normalize_ty_after_erasing_regions<'tcx>( @@ -22,23 +19,17 @@ fn normalize_ty_after_erasing_regions<'tcx>( tcx.infer_ctxt().enter(|infcx| { let cause = ObligationCause::dummy(); match infcx.at(&cause, param_env).normalize(&value) { - Ok(Normalized { - value: normalized_value, - obligations: normalized_obligations, - }) => { + Ok(Normalized { value: normalized_value, obligations: normalized_obligations }) => { // We don't care about the `obligations`; they are // always only region relations, and we are about to // erase those anyway: debug_assert_eq!( - normalized_obligations - .iter() - .find(|p| not_outlives_predicate(&p.predicate)), + normalized_obligations.iter().find(|p| not_outlives_predicate(&p.predicate)), None, ); let normalized_value = infcx.resolve_vars_if_possible(&normalized_value); - let normalized_value = infcx.tcx.erase_regions(&normalized_value); - tcx.lift_to_global(&normalized_value).unwrap() + infcx.tcx.erase_regions(&normalized_value) } Err(NoSolution) => bug!("could not fully normalize `{:?}`", value), }