mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Match on both reveal and solver mode at the same time
This commit is contained in:
parent
980da667fe
commit
dd98198972
@ -15,9 +15,8 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||||||
let opaque_ty = goal.predicate.projection_ty;
|
let opaque_ty = goal.predicate.projection_ty;
|
||||||
let expected = goal.predicate.term.ty().expect("no such thing as an opaque const");
|
let expected = goal.predicate.term.ty().expect("no such thing as an opaque const");
|
||||||
|
|
||||||
match goal.param_env.reveal() {
|
match (goal.param_env.reveal(), self.solver_mode()) {
|
||||||
Reveal::UserFacing => match self.solver_mode() {
|
(Reveal::UserFacing, SolverMode::Normal) => {
|
||||||
SolverMode::Normal => {
|
|
||||||
let Some(opaque_ty_def_id) = opaque_ty.def_id.as_local() else {
|
let Some(opaque_ty_def_id) = opaque_ty.def_id.as_local() else {
|
||||||
return Err(NoSolution);
|
return Err(NoSolution);
|
||||||
};
|
};
|
||||||
@ -42,8 +41,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
}
|
}
|
||||||
// Prefer opaques registered already.
|
// Prefer opaques registered already.
|
||||||
let matches =
|
let matches = self.unify_existing_opaque_tys(goal.param_env, opaque_ty, expected);
|
||||||
self.unify_existing_opaque_tys(goal.param_env, opaque_ty, expected);
|
|
||||||
if !matches.is_empty() {
|
if !matches.is_empty() {
|
||||||
if let Some(response) = self.try_merge_responses(&matches) {
|
if let Some(response) = self.try_merge_responses(&matches) {
|
||||||
return Ok(response);
|
return Ok(response);
|
||||||
@ -55,11 +53,10 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||||||
self.register_opaque_ty(opaque_ty, expected, goal.param_env)?;
|
self.register_opaque_ty(opaque_ty, expected, goal.param_env)?;
|
||||||
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
|
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
|
||||||
}
|
}
|
||||||
SolverMode::Coherence => {
|
(Reveal::UserFacing, SolverMode::Coherence) => {
|
||||||
self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
|
self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
|
||||||
}
|
}
|
||||||
},
|
(Reveal::All, _) => {
|
||||||
Reveal::All => {
|
|
||||||
// FIXME: Add an assertion that opaque type storage is empty.
|
// FIXME: Add an assertion that opaque type storage is empty.
|
||||||
let actual = tcx.type_of(opaque_ty.def_id).subst(tcx, opaque_ty.substs);
|
let actual = tcx.type_of(opaque_ty.def_id).subst(tcx, opaque_ty.substs);
|
||||||
self.eq(goal.param_env, expected, actual)?;
|
self.eq(goal.param_env, expected, actual)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user