mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Check reveal and can_define_opaque_ty in try_normalize_ty_recur
This commit is contained in:
parent
e927184629
commit
f49b0dcce2
@ -22,6 +22,7 @@ use rustc_middle::traits::solve::{
|
|||||||
CanonicalResponse, Certainty, ExternalConstraintsData, Goal, GoalSource, IsNormalizesToHack,
|
CanonicalResponse, Certainty, ExternalConstraintsData, Goal, GoalSource, IsNormalizesToHack,
|
||||||
QueryResult, Response,
|
QueryResult, Response,
|
||||||
};
|
};
|
||||||
|
use rustc_middle::traits::Reveal;
|
||||||
use rustc_middle::ty::{self, OpaqueTypeKey, Ty, TyCtxt, UniverseIndex};
|
use rustc_middle::ty::{self, OpaqueTypeKey, Ty, TyCtxt, UniverseIndex};
|
||||||
use rustc_middle::ty::{
|
use rustc_middle::ty::{
|
||||||
CoercePredicate, RegionOutlivesPredicate, SubtypePredicate, TypeOutlivesPredicate,
|
CoercePredicate, RegionOutlivesPredicate, SubtypePredicate, TypeOutlivesPredicate,
|
||||||
@ -317,8 +318,12 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// We do no always define opaque types eagerly to allow non-defining uses in the defining scope.
|
// We do no always define opaque types eagerly to allow non-defining uses in the defining scope.
|
||||||
if let (DefineOpaqueTypes::No, ty::AliasKind::Opaque) = (define_opaque_types, kind) {
|
if let DefineOpaqueTypes::No = define_opaque_types
|
||||||
if let Some(def_id) = alias.def_id.as_local() {
|
&& let Reveal::UserFacing = param_env.reveal()
|
||||||
|
&& let ty::Opaque = kind
|
||||||
|
&& let Some(def_id) = alias.def_id.as_local()
|
||||||
|
&& self.can_define_opaque_ty(def_id)
|
||||||
|
{
|
||||||
if self
|
if self
|
||||||
.unify_existing_opaque_tys(
|
.unify_existing_opaque_tys(
|
||||||
param_env,
|
param_env,
|
||||||
@ -330,7 +335,6 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||||||
return Some(ty);
|
return Some(ty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
match self.commit_if_ok(|this| {
|
match self.commit_if_ok(|this| {
|
||||||
let normalized_ty = this.next_ty_infer();
|
let normalized_ty = this.next_ty_infer();
|
||||||
|
Loading…
Reference in New Issue
Block a user