Skip to content

Commit d87f4a6

Browse files
Placeholder nit
1 parent f848fd3 commit d87f4a6

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -562,15 +562,9 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
562562
V: TypeFoldable<TyCtxt<'tcx>>,
563563
{
564564
let needs_canonical_flags = if canonicalize_region_mode.any() {
565-
TypeFlags::HAS_INFER |
566-
TypeFlags::HAS_FREE_REGIONS | // `HAS_RE_PLACEHOLDER` implies `HAS_FREE_REGIONS`
567-
TypeFlags::HAS_TY_PLACEHOLDER |
568-
TypeFlags::HAS_CT_PLACEHOLDER
565+
TypeFlags::HAS_INFER | TypeFlags::HAS_PLACEHOLDER | TypeFlags::HAS_FREE_REGIONS
569566
} else {
570-
TypeFlags::HAS_INFER
571-
| TypeFlags::HAS_RE_PLACEHOLDER
572-
| TypeFlags::HAS_TY_PLACEHOLDER
573-
| TypeFlags::HAS_CT_PLACEHOLDER
567+
TypeFlags::HAS_INFER | TypeFlags::HAS_PLACEHOLDER
574568
};
575569

576570
// Fast path: nothing that needs to be canonicalized.

compiler/rustc_middle/src/ty/visit.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,10 @@ pub trait TypeVisitableExt<'tcx>: TypeVisitable<TyCtxt<'tcx>> {
8888
self.has_type_flags(TypeFlags::HAS_INFER)
8989
}
9090
fn has_placeholders(&self) -> bool {
91-
self.has_type_flags(
92-
TypeFlags::HAS_RE_PLACEHOLDER
93-
| TypeFlags::HAS_TY_PLACEHOLDER
94-
| TypeFlags::HAS_CT_PLACEHOLDER,
95-
)
91+
self.has_type_flags(TypeFlags::HAS_PLACEHOLDER)
9692
}
9793
fn has_non_region_placeholders(&self) -> bool {
98-
self.has_type_flags(TypeFlags::HAS_TY_PLACEHOLDER | TypeFlags::HAS_CT_PLACEHOLDER)
94+
self.has_type_flags(TypeFlags::HAS_PLACEHOLDER - TypeFlags::HAS_RE_PLACEHOLDER)
9995
}
10096
fn has_param(&self) -> bool {
10197
self.has_type_flags(TypeFlags::HAS_PARAM)

compiler/rustc_type_ir/src/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ bitflags! {
215215
/// Does this have `ConstKind::Placeholder`?
216216
const HAS_CT_PLACEHOLDER = 1 << 8;
217217

218+
/// Does this have placeholders?
219+
const HAS_PLACEHOLDER = TypeFlags::HAS_TY_PLACEHOLDER.bits
220+
| TypeFlags::HAS_RE_PLACEHOLDER.bits
221+
| TypeFlags::HAS_CT_PLACEHOLDER.bits;
222+
218223
/// `true` if there are "names" of regions and so forth
219224
/// that are local to a particular fn/inferctxt
220225
const HAS_FREE_LOCAL_REGIONS = 1 << 9;

0 commit comments

Comments
 (0)