Pack Term
in the same way as GenericArg
.
This shrinks the `PredicateS` type, which is instanted frequently.
This commit is contained in:
parent
d565d51071
commit
79db32b64e
20 changed files with 191 additions and 108 deletions
|
@ -10,7 +10,7 @@ use crate::traits::project::ProjectAndUnifyResult;
|
|||
use rustc_middle::mir::interpret::ErrorHandled;
|
||||
use rustc_middle::ty::fold::{TypeFolder, TypeSuperFoldable};
|
||||
use rustc_middle::ty::visit::TypeVisitable;
|
||||
use rustc_middle::ty::{Region, RegionVid, Term};
|
||||
use rustc_middle::ty::{Region, RegionVid};
|
||||
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
|
||||
|
@ -612,7 +612,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
|||
}
|
||||
|
||||
fn is_self_referential_projection(&self, p: ty::PolyProjectionPredicate<'_>) -> bool {
|
||||
if let Term::Ty(ty) = p.term().skip_binder() {
|
||||
if let Some(ty) = p.term().skip_binder().ty() {
|
||||
matches!(ty.kind(), ty::Projection(proj) if proj == &p.skip_binder().projection_ty)
|
||||
} else {
|
||||
false
|
||||
|
|
|
@ -552,7 +552,7 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
|
|||
)
|
||||
.ok()
|
||||
.flatten()
|
||||
.unwrap_or_else(|| ty::Term::Ty(ty.super_fold_with(self)))
|
||||
.unwrap_or_else(|| ty.super_fold_with(self).into())
|
||||
};
|
||||
// For cases like #95134 we would like to catch overflows early
|
||||
// otherwise they slip away away and cause ICE.
|
||||
|
|
|
@ -129,9 +129,9 @@ pub fn predicate_obligations<'a, 'tcx>(
|
|||
}
|
||||
ty::PredicateKind::Projection(t) => {
|
||||
wf.compute_projection(t.projection_ty);
|
||||
wf.compute(match t.term {
|
||||
ty::Term::Ty(ty) => ty.into(),
|
||||
ty::Term::Const(c) => c.into(),
|
||||
wf.compute(match t.term.unpack() {
|
||||
ty::TermKind::Ty(ty) => ty.into(),
|
||||
ty::TermKind::Const(c) => c.into(),
|
||||
})
|
||||
}
|
||||
ty::PredicateKind::WellFormed(arg) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue