Skip to content

Commit 05995a8

Browse files
committed
Introduce TyKind::Placeholder variant
1 parent 7401e3d commit 05995a8

File tree

30 files changed

+46
-13
lines changed

30 files changed

+46
-13
lines changed

src/librustc/ich/impls_ty.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,9 @@ for ty::TyKind<'gcx>
687687
Bound(bound_ty) => {
688688
bound_ty.hash_stable(hcx, hasher);
689689
}
690+
ty::Placeholder(placeholder_ty) => {
691+
placeholder_ty.hash_stable(hcx, hasher);
692+
}
690693
Foreign(def_id) => {
691694
def_id.hash_stable(hcx, hasher);
692695
}

src/librustc/infer/canonical/canonicalizer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
380380
| ty::Never
381381
| ty::Tuple(..)
382382
| ty::Projection(..)
383+
| ty::Placeholder(..)
383384
| ty::UnnormalizedProjection(..)
384385
| ty::Foreign(..)
385386
| ty::Param(..)

src/librustc/infer/freshen.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,6 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
170170
t
171171
}
172172

173-
ty::Bound(..) =>
174-
bug!("encountered bound ty during freshening"),
175-
176173
ty::Generator(..) |
177174
ty::Bool |
178175
ty::Char |
@@ -200,6 +197,9 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
200197
ty::Opaque(..) => {
201198
t.super_fold_with(self)
202199
}
200+
201+
ty::Placeholder(..) |
202+
ty::Bound(..) => bug!("unexpected type {:?}", t),
203203
}
204204
}
205205
}

src/librustc/traits/coherence.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ fn ty_is_local_constructor(ty: Ty<'_>, in_crate: InCrate) -> bool {
455455
false
456456
}
457457

458-
ty::Bound(..) | ty::Infer(..) => match in_crate {
458+
ty::Placeholder(..) | ty::Bound(..) | ty::Infer(..) => match in_crate {
459459
InCrate::Local => false,
460460
// The inference variable might be unified with a local
461461
// type in that remote crate.

src/librustc/traits/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
281281
ty::Generator(..) => Some(18),
282282
ty::Foreign(..) => Some(19),
283283
ty::GeneratorWitness(..) => Some(20),
284-
ty::Bound(..) | ty::Infer(..) | ty::Error => None,
284+
ty::Placeholder(..) | ty::Bound(..) | ty::Infer(..) | ty::Error => None,
285285
ty::UnnormalizedProjection(..) => bug!("only used with chalk-engine"),
286286
}
287287
}

src/librustc/traits/query/dropck_outlives.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) ->
251251
| ty::Projection(..)
252252
| ty::Param(_)
253253
| ty::Opaque(..)
254+
| ty::Placeholder(..)
254255
| ty::Infer(_)
255256
| ty::Bound(..)
256257
| ty::Generator(..) => false,

src/librustc/traits/select.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,6 +2470,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
24702470
ty::Infer(ty::TyVar(_)) => Ambiguous,
24712471

24722472
ty::UnnormalizedProjection(..)
2473+
| ty::Placeholder(..)
24732474
| ty::Bound(_)
24742475
| ty::Infer(ty::FreshTy(_))
24752476
| ty::Infer(ty::FreshIntTy(_))
@@ -2555,6 +2556,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
25552556
}
25562557

25572558
ty::UnnormalizedProjection(..)
2559+
| ty::Placeholder(..)
25582560
| ty::Bound(_)
25592561
| ty::Infer(ty::FreshTy(_))
25602562
| ty::Infer(ty::FreshIntTy(_))
@@ -2594,6 +2596,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
25942596
| ty::Char => Vec::new(),
25952597

25962598
ty::UnnormalizedProjection(..)
2599+
| ty::Placeholder(..)
25972600
| ty::Dynamic(..)
25982601
| ty::Param(..)
25992602
| ty::Foreign(..)

src/librustc/ty/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2250,7 +2250,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
22502250
pub fn print_debug_stats(self) {
22512251
sty_debug_print!(
22522252
self,
2253-
Adt, Array, Slice, RawPtr, Ref, FnDef, FnPtr,
2253+
Adt, Array, Slice, RawPtr, Ref, FnDef, FnPtr, Placeholder,
22542254
Generator, GeneratorWitness, Dynamic, Closure, Tuple, Bound,
22552255
Param, Infer, UnnormalizedProjection, Projection, Opaque, Foreign);
22562256

src/librustc/ty/error.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> {
212212
ty::Infer(ty::TyVar(_)) => "inferred type".into(),
213213
ty::Infer(ty::IntVar(_)) => "integral variable".into(),
214214
ty::Infer(ty::FloatVar(_)) => "floating-point variable".into(),
215+
ty::Placeholder(..) => "placeholder type".into(),
215216
ty::Bound(_) |
216217
ty::Infer(ty::FreshTy(_)) => "fresh type".into(),
217218
ty::Infer(ty::FreshIntTy(_)) => "fresh integral type".into(),

src/librustc/ty/fast_reject.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
122122
ty::Foreign(def_id) => {
123123
Some(ForeignSimplifiedType(def_id))
124124
}
125-
ty::Bound(..) | ty::Infer(_) | ty::Error => None,
125+
ty::Placeholder(..) | ty::Bound(..) | ty::Infer(_) | ty::Error => None,
126126
}
127127
}
128128

0 commit comments

Comments
 (0)