summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_traits/src/normalize_erasing_regions.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--compiler/rustc_traits/src/normalize_erasing_regions.rs46
1 files changed, 21 insertions, 25 deletions
diff --git a/compiler/rustc_traits/src/normalize_erasing_regions.rs b/compiler/rustc_traits/src/normalize_erasing_regions.rs
index 5d394ed22..2da64d73d 100644
--- a/compiler/rustc_traits/src/normalize_erasing_regions.rs
+++ b/compiler/rustc_traits/src/normalize_erasing_regions.rs
@@ -18,9 +18,6 @@ pub(crate) fn provide(p: &mut Providers) {
try_normalize_after_erasing_regions(tcx, goal)
},
- try_normalize_mir_const_after_erasing_regions: |tcx, goal| {
- try_normalize_after_erasing_regions(tcx, goal)
- },
..*p
};
}
@@ -30,30 +27,29 @@ fn try_normalize_after_erasing_regions<'tcx, T: TypeFoldable<'tcx> + PartialEq +
goal: ParamEnvAnd<'tcx, T>,
) -> Result<T, NoSolution> {
let ParamEnvAnd { param_env, value } = goal;
- 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 }) => {
- // 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)),
- None,
- );
+ let infcx = tcx.infer_ctxt().build();
+ let cause = ObligationCause::dummy();
+ match infcx.at(&cause, param_env).normalize(value) {
+ 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)),
+ None,
+ );
- let resolved_value = infcx.resolve_vars_if_possible(normalized_value);
- // It's unclear when `resolve_vars` would have an effect in a
- // fresh `InferCtxt`. If this assert does trigger, it will give
- // us a test case.
- debug_assert_eq!(normalized_value, resolved_value);
- let erased = infcx.tcx.erase_regions(resolved_value);
- debug_assert!(!erased.needs_infer(), "{:?}", erased);
- Ok(erased)
- }
- Err(NoSolution) => Err(NoSolution),
+ let resolved_value = infcx.resolve_vars_if_possible(normalized_value);
+ // It's unclear when `resolve_vars` would have an effect in a
+ // fresh `InferCtxt`. If this assert does trigger, it will give
+ // us a test case.
+ debug_assert_eq!(normalized_value, resolved_value);
+ let erased = infcx.tcx.erase_regions(resolved_value);
+ debug_assert!(!erased.needs_infer(), "{:?}", erased);
+ Ok(erased)
}
- })
+ Err(NoSolution) => Err(NoSolution),
+ }
}
fn not_outlives_predicate<'tcx>(p: ty::Predicate<'tcx>) -> bool {