Skip to content

Commit c996cfe

Browse files
committed
Stop bubbling out hidden types from the eval obligation queries
1 parent 54d6738 commit c996cfe

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

compiler/rustc_traits/src/evaluate_obligation.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use rustc_infer::infer::TyCtxtInferExt;
22
use rustc_middle::query::Providers;
3-
use rustc_middle::traits::DefiningAnchor;
43
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
54
use rustc_span::source_map::DUMMY_SP;
65
use rustc_trait_selection::traits::query::CanonicalPredicateGoal;
@@ -18,12 +17,8 @@ fn evaluate_obligation<'tcx>(
1817
) -> Result<EvaluationResult, OverflowError> {
1918
assert!(!tcx.next_trait_solver_globally());
2019
debug!("evaluate_obligation(canonical_goal={:#?})", canonical_goal);
21-
// HACK This bubble is required for this tests to pass:
22-
// impl-trait/issue99642.rs
23-
let (ref infcx, goal, _canonical_inference_vars) = tcx
24-
.infer_ctxt()
25-
.with_opaque_type_inference(DefiningAnchor::Bubble)
26-
.build_with_canonical(DUMMY_SP, &canonical_goal);
20+
let (ref infcx, goal, _canonical_inference_vars) =
21+
tcx.infer_ctxt().build_with_canonical(DUMMY_SP, &canonical_goal);
2722
debug!("evaluate_obligation: goal={:#?}", goal);
2823
let ParamEnvAnd { param_env, value: predicate } = goal;
2924

compiler/rustc_traits/src/type_op.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use rustc_infer::infer::canonical::{Canonical, QueryResponse};
22
use rustc_infer::infer::TyCtxtInferExt;
33
use rustc_middle::query::Providers;
44
use rustc_middle::traits::query::NoSolution;
5-
use rustc_middle::traits::DefiningAnchor;
65
use rustc_middle::ty::{FnSig, Lift, PolyFnSig, Ty, TyCtxt, TypeFoldable};
76
use rustc_middle::ty::{ParamEnvAnd, Predicate};
87
use rustc_trait_selection::infer::InferCtxtBuilderExt;
@@ -106,15 +105,10 @@ fn type_op_prove_predicate<'tcx>(
106105
tcx: TyCtxt<'tcx>,
107106
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, ProvePredicate<'tcx>>>,
108107
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> {
109-
// HACK This bubble is required for this test to pass:
110-
// impl-trait/issue-99642.rs
111-
tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bubble).enter_canonical_trait_query(
112-
&canonicalized,
113-
|ocx, key| {
114-
type_op_prove_predicate_with_cause(ocx, key, ObligationCause::dummy());
115-
Ok(())
116-
},
117-
)
108+
tcx.infer_ctxt().enter_canonical_trait_query(&canonicalized, |ocx, key| {
109+
type_op_prove_predicate_with_cause(ocx, key, ObligationCause::dummy());
110+
Ok(())
111+
})
118112
}
119113

120114
/// The core of the `type_op_prove_predicate` query: for diagnostics purposes in NLL HRTB errors,

0 commit comments

Comments
 (0)