Avoid fetching the opaque type origin when only "is this in the defining scope" is actually needed
This commit is contained in:
parent
ba5f0418af
commit
7cfa521931
5 changed files with 16 additions and 27 deletions
|
@ -1,5 +1,5 @@
|
|||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_infer::infer::at::ToTrace;
|
||||
use rustc_infer::infer::canonical::CanonicalVarValues;
|
||||
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
|
@ -935,8 +935,8 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
pub(super) fn can_define_opaque_ty(&self, def_id: LocalDefId) -> bool {
|
||||
self.infcx.opaque_type_origin(def_id).is_some()
|
||||
pub(super) fn can_define_opaque_ty(&self, def_id: impl Into<DefId>) -> bool {
|
||||
self.infcx.can_define_opaque_ty(def_id)
|
||||
}
|
||||
|
||||
pub(super) fn insert_hidden_type(
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue