1
Fork 0

Avoid fetching the opaque type origin when only "is this in the defining scope" is actually needed

This commit is contained in:
Oli Scherer 2024-03-14 11:40:28 +00:00
parent ba5f0418af
commit 7cfa521931
5 changed files with 16 additions and 27 deletions

View file

@ -155,10 +155,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
if let ty::Alias(ty::Opaque, opaque_ty) = goal.predicate.self_ty().kind() {
if matches!(goal.param_env.reveal(), Reveal::All)
|| matches!(ecx.solver_mode(), SolverMode::Coherence)
|| opaque_ty
.def_id
.as_local()
.is_some_and(|def_id| ecx.can_define_opaque_ty(def_id))
|| ecx.can_define_opaque_ty(opaque_ty.def_id)
{
return Err(NoSolution);
}