diff options
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve/opaques.rs')
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/opaques.rs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/opaques.rs b/compiler/rustc_trait_selection/src/solve/opaques.rs index 1a770459338..7d6e1647cfc 100644 --- a/compiler/rustc_trait_selection/src/solve/opaques.rs +++ b/compiler/rustc_trait_selection/src/solve/opaques.rs @@ -1,14 +1,13 @@ -use rustc_infer::infer::InferOk; use rustc_middle::traits::solve::{Certainty, Goal, QueryResult}; -use rustc_middle::traits::{ObligationCause, Reveal}; -use rustc_middle::ty::ProjectionPredicate; +use rustc_middle::traits::Reveal; +use rustc_middle::ty::{self}; use super::{EvalCtxt, SolverMode}; impl<'tcx> EvalCtxt<'_, 'tcx> { pub(super) fn normalize_opaque_type( &mut self, - goal: Goal<'tcx, ProjectionPredicate<'tcx>>, + goal: Goal<'tcx, ty::ProjectionPredicate<'tcx>>, ) -> QueryResult<'tcx> { let tcx = self.tcx(); let opaque_ty = goal.predicate.projection_ty; @@ -19,15 +18,8 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { SolverMode::Normal => self.probe(|ecx| { // FIXME: Check that the usage is "defining" (all free params), otherwise bail. // FIXME: This should probably just check the anchor directly - let InferOk { value: (), obligations } = self.infcx.handle_opaque_type( - expected, - tcx.mk_opaque(opaque_ty.def_id, opaque_ty.substs), - true, - &ObligationCause::dummy(), - goal.param_env, - )?; - // FIXME: Need to fold these to replace the opaque ty with the expected ty. - ecx.add_goals(obligations.into_iter().map(Into::into)); + let opaque_ty = tcx.mk_opaque(opaque_ty.def_id, opaque_ty.substs); + ecx.handle_opaque_ty(expected, opaque_ty, goal.param_env)?; ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) }), SolverMode::Coherence => { |
