Skip to content

Commit ce7b755

Browse files
committed
Prevent MIRI ice by bubbling up
1 parent 8716eae commit ce7b755

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

compiler/rustc_traits/src/normalize_erasing_regions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rustc_infer::infer::TyCtxtInferExt;
1+
use rustc_infer::infer::{DefiningAnchor,TyCtxtInferExt};
22
use rustc_middle::traits::query::NoSolution;
33
use rustc_middle::ty::query::Providers;
44
use rustc_middle::ty::{self, ParamEnvAnd, TyCtxt, TypeFoldable};
@@ -30,7 +30,7 @@ fn try_normalize_after_erasing_regions<'tcx, T: TypeFoldable<'tcx> + PartialEq +
3030
goal: ParamEnvAnd<'tcx, T>,
3131
) -> Result<T, NoSolution> {
3232
let ParamEnvAnd { param_env, value } = goal;
33-
tcx.infer_ctxt().enter(|infcx| {
33+
tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bubble).enter(|infcx| {
3434
let cause = ObligationCause::dummy();
3535
match infcx.at(&cause, param_env).normalize(value) {
3636
Ok(Normalized { value: normalized_value, obligations: normalized_obligations }) => {

compiler/rustc_traits/src/normalize_projection_ty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc_infer::infer::canonical::{Canonical, QueryResponse};
2-
use rustc_infer::infer::TyCtxtInferExt;
2+
use rustc_infer::infer::{DefiningAnchor,TyCtxtInferExt};
33
use rustc_infer::traits::TraitEngineExt as _;
44
use rustc_middle::ty::query::Providers;
55
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
@@ -21,7 +21,7 @@ fn normalize_projection_ty<'tcx>(
2121
debug!("normalize_provider(goal={:#?})", goal);
2222

2323
tcx.sess.perf_stats.normalize_projection_ty.fetch_add(1, Ordering::Relaxed);
24-
tcx.infer_ctxt().enter_canonical_trait_query(
24+
tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bubble).enter_canonical_trait_query(
2525
&goal,
2626
|infcx, fulfill_cx, ParamEnvAnd { param_env, value: goal }| {
2727
let selcx = &mut SelectionContext::new(infcx);

0 commit comments

Comments
 (0)