Rollup merge of #152396 - ShoyuVanilla:uplift-allow-normalize, r=lcnr
Uplift `Predicate::allow_normalization` to `rustc_type_ir` Found this FIXME comment while fixing a bug in rust-analyzer 😄 cc https://github.com/rust-lang/rust-analyzer/pull/21611 r? types
This commit is contained in:
commit
083622cdd0
2 changed files with 23 additions and 26 deletions
|
|
@ -49,10 +49,6 @@ impl<'tcx> rustc_type_ir::inherent::Predicate<TyCtxt<'tcx>> for Predicate<'tcx>
|
|||
fn as_clause(self) -> Option<ty::Clause<'tcx>> {
|
||||
self.as_clause()
|
||||
}
|
||||
|
||||
fn allow_normalization(self) -> bool {
|
||||
self.allow_normalization()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> rustc_type_ir::inherent::IntoKind for Predicate<'tcx> {
|
||||
|
|
@ -121,25 +117,7 @@ impl<'tcx> Predicate<'tcx> {
|
|||
/// unsoundly accept some programs. See #91068.
|
||||
#[inline]
|
||||
pub fn allow_normalization(self) -> bool {
|
||||
match self.kind().skip_binder() {
|
||||
PredicateKind::Clause(ClauseKind::WellFormed(_)) | PredicateKind::AliasRelate(..) => {
|
||||
false
|
||||
}
|
||||
PredicateKind::Clause(ClauseKind::Trait(_))
|
||||
| PredicateKind::Clause(ClauseKind::HostEffect(..))
|
||||
| PredicateKind::Clause(ClauseKind::RegionOutlives(_))
|
||||
| PredicateKind::Clause(ClauseKind::TypeOutlives(_))
|
||||
| PredicateKind::Clause(ClauseKind::Projection(_))
|
||||
| PredicateKind::Clause(ClauseKind::ConstArgHasType(..))
|
||||
| PredicateKind::Clause(ClauseKind::UnstableFeature(_))
|
||||
| PredicateKind::DynCompatible(_)
|
||||
| PredicateKind::Subtype(_)
|
||||
| PredicateKind::Coerce(_)
|
||||
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(_))
|
||||
| PredicateKind::ConstEquate(_, _)
|
||||
| PredicateKind::NormalizesTo(..)
|
||||
| PredicateKind::Ambiguous => true,
|
||||
}
|
||||
rustc_type_ir::inherent::Predicate::allow_normalization(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use crate::fold::{TypeFoldable, TypeSuperFoldable};
|
|||
use crate::relate::Relate;
|
||||
use crate::solve::{AdtDestructorKind, SizedTraitKind};
|
||||
use crate::visit::{Flags, TypeSuperVisitable, TypeVisitable};
|
||||
use crate::{self as ty, CollectAndApply, Interner, UpcastFrom};
|
||||
use crate::{self as ty, ClauseKind, CollectAndApply, Interner, PredicateKind, UpcastFrom};
|
||||
|
||||
pub trait Ty<I: Interner<Ty = Self>>:
|
||||
Copy
|
||||
|
|
@ -478,8 +478,27 @@ pub trait Predicate<I: Interner<Predicate = Self>>:
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: Eventually uplift the impl out of rustc and make this defaulted.
|
||||
fn allow_normalization(self) -> bool;
|
||||
fn allow_normalization(self) -> bool {
|
||||
match self.kind().skip_binder() {
|
||||
PredicateKind::Clause(ClauseKind::WellFormed(_)) | PredicateKind::AliasRelate(..) => {
|
||||
false
|
||||
}
|
||||
PredicateKind::Clause(ClauseKind::Trait(_))
|
||||
| PredicateKind::Clause(ClauseKind::HostEffect(..))
|
||||
| PredicateKind::Clause(ClauseKind::RegionOutlives(_))
|
||||
| PredicateKind::Clause(ClauseKind::TypeOutlives(_))
|
||||
| PredicateKind::Clause(ClauseKind::Projection(_))
|
||||
| PredicateKind::Clause(ClauseKind::ConstArgHasType(..))
|
||||
| PredicateKind::Clause(ClauseKind::UnstableFeature(_))
|
||||
| PredicateKind::DynCompatible(_)
|
||||
| PredicateKind::Subtype(_)
|
||||
| PredicateKind::Coerce(_)
|
||||
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(_))
|
||||
| PredicateKind::ConstEquate(_, _)
|
||||
| PredicateKind::NormalizesTo(..)
|
||||
| PredicateKind::Ambiguous => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Clause<I: Interner<Clause = Self>>:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue