Rollup merge of #127570 - lcnr:normalize-cool, r=compiler-errors
small normalization improvement r? `@compiler-errors`
This commit is contained in:
commit
22df186d6f
3 changed files with 10 additions and 13 deletions
|
@ -109,16 +109,13 @@ pub(super) fn needs_normalization<'tcx, T: TypeVisitable<TyCtxt<'tcx>>>(
|
|||
value: &T,
|
||||
reveal: Reveal,
|
||||
) -> bool {
|
||||
// This mirrors `ty::TypeFlags::HAS_ALIASES` except that we take `Reveal` into account.
|
||||
|
||||
let mut flags = ty::TypeFlags::HAS_TY_PROJECTION
|
||||
| ty::TypeFlags::HAS_TY_WEAK
|
||||
| ty::TypeFlags::HAS_TY_INHERENT
|
||||
| ty::TypeFlags::HAS_CT_PROJECTION;
|
||||
let mut flags = ty::TypeFlags::HAS_ALIAS;
|
||||
|
||||
// Opaques are treated as rigid with `Reveal::UserFacing`,
|
||||
// so we can ignore those.
|
||||
match reveal {
|
||||
Reveal::UserFacing => {}
|
||||
Reveal::All => flags |= ty::TypeFlags::HAS_TY_OPAQUE,
|
||||
Reveal::UserFacing => flags.remove(ty::TypeFlags::HAS_TY_OPAQUE),
|
||||
Reveal::All => {}
|
||||
}
|
||||
|
||||
value.has_type_flags(flags)
|
||||
|
|
|
@ -81,7 +81,7 @@ bitflags::bitflags! {
|
|||
/// Does this have `Alias` or `ConstKind::Unevaluated`?
|
||||
///
|
||||
/// Rephrased, could this term be normalized further?
|
||||
const HAS_ALIASES = TypeFlags::HAS_TY_PROJECTION.bits()
|
||||
const HAS_ALIAS = TypeFlags::HAS_TY_PROJECTION.bits()
|
||||
| TypeFlags::HAS_TY_WEAK.bits()
|
||||
| TypeFlags::HAS_TY_OPAQUE.bits()
|
||||
| TypeFlags::HAS_TY_INHERENT.bits()
|
||||
|
|
|
@ -230,7 +230,7 @@ pub trait TypeVisitableExt<I: Interner>: TypeVisitable<I> {
|
|||
}
|
||||
|
||||
fn has_aliases(&self) -> bool {
|
||||
self.has_type_flags(TypeFlags::HAS_ALIASES)
|
||||
self.has_type_flags(TypeFlags::HAS_ALIAS)
|
||||
}
|
||||
|
||||
fn has_inherent_projections(&self) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue