Skip to content

Commit 91623ca

Browse files
committed
Add HAS_TY_PLACEHOLDER flag
1 parent da3def3 commit 91623ca

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

src/librustc/infer/canonical/canonicalizer.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,13 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
409409
V: TypeFoldable<'tcx> + Lift<'gcx>,
410410
{
411411
let needs_canonical_flags = if canonicalize_region_mode.any() {
412-
TypeFlags::HAS_FREE_REGIONS | TypeFlags::KEEP_IN_LOCAL_TCX
412+
TypeFlags::KEEP_IN_LOCAL_TCX |
413+
TypeFlags::HAS_FREE_REGIONS | // `HAS_RE_PLACEHOLDER` implies `HAS_FREE_REGIONS`
414+
TypeFlags::HAS_TY_PLACEHOLDER
413415
} else {
414-
TypeFlags::KEEP_IN_LOCAL_TCX
416+
TypeFlags::KEEP_IN_LOCAL_TCX |
417+
TypeFlags::HAS_RE_PLACEHOLDER |
418+
TypeFlags::HAS_TY_PLACEHOLDER
415419
};
416420

417421
let gcx = tcx.global_tcx();

src/librustc/ty/flags.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ impl FlagComputation {
7474
&ty::Uint(_) |
7575
&ty::Never |
7676
&ty::Str |
77-
&ty::Placeholder(..) |
7877
&ty::Foreign(..) => {
7978
}
8079

@@ -120,6 +119,10 @@ impl FlagComputation {
120119
self.add_binder(bound_ty.index);
121120
}
122121

122+
&ty::Placeholder(..) => {
123+
self.add_flags(TypeFlags::HAS_TY_PLACEHOLDER);
124+
}
125+
123126
&ty::Infer(infer) => {
124127
self.add_flags(TypeFlags::HAS_FREE_LOCAL_NAMES); // it might, right?
125128
self.add_flags(TypeFlags::HAS_TY_INFER);

src/librustc/ty/fold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
103103
self.has_type_flags(TypeFlags::HAS_TY_INFER | TypeFlags::HAS_RE_INFER)
104104
}
105105
fn has_placeholders(&self) -> bool {
106-
self.has_type_flags(TypeFlags::HAS_RE_PLACEHOLDER)
106+
self.has_type_flags(TypeFlags::HAS_RE_PLACEHOLDER | TypeFlags::HAS_TY_PLACEHOLDER)
107107
}
108108
fn needs_subst(&self) -> bool {
109109
self.has_type_flags(TypeFlags::NEEDS_SUBST)

src/librustc/ty/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,8 @@ bitflags! {
467467
/// if a global bound is safe to evaluate.
468468
const HAS_RE_LATE_BOUND = 1 << 13;
469469

470+
const HAS_TY_PLACEHOLDER = 1 << 14;
471+
470472
const NEEDS_SUBST = TypeFlags::HAS_PARAMS.bits |
471473
TypeFlags::HAS_SELF.bits |
472474
TypeFlags::HAS_RE_EARLY_BOUND.bits;
@@ -486,7 +488,8 @@ bitflags! {
486488
TypeFlags::HAS_TY_CLOSURE.bits |
487489
TypeFlags::HAS_FREE_LOCAL_NAMES.bits |
488490
TypeFlags::KEEP_IN_LOCAL_TCX.bits |
489-
TypeFlags::HAS_RE_LATE_BOUND.bits;
491+
TypeFlags::HAS_RE_LATE_BOUND.bits |
492+
TypeFlags::HAS_TY_PLACEHOLDER.bits;
490493
}
491494
}
492495

0 commit comments

Comments
 (0)