Skip to content

File tree

30 files changed

+46
-13
lines changed

30 files changed

+46
-13
lines changed
 

‎src/librustc/ich/impls_ty.rs

+3
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

+1
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

+3-3
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

+1-1
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

+1-1
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

+1
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

+3
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

+1-1
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

+1
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

+1-1
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

‎src/librustc/ty/flags.rs

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ impl FlagComputation {
7474
&ty::Uint(_) |
7575
&ty::Never |
7676
&ty::Str |
77+
&ty::Placeholder(..) |
7778
&ty::Foreign(..) => {
7879
}
7980

‎src/librustc/ty/item_path.rs

+1
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ pub fn characteristic_def_id_of_type(ty: Ty<'_>) -> Option<DefId> {
515515
ty::Str |
516516
ty::FnPtr(_) |
517517
ty::Projection(_) |
518+
ty::Placeholder(..) |
518519
ty::UnnormalizedProjection(..) |
519520
ty::Param(_) |
520521
ty::Opaque(..) |

‎src/librustc/ty/layout.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
11591159
}
11601160

11611161
ty::Bound(..) |
1162+
ty::Placeholder(..) |
11621163
ty::UnnormalizedProjection(..) |
11631164
ty::GeneratorWitness(..) |
11641165
ty::Infer(_) => {
@@ -1743,7 +1744,8 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
17431744
}
17441745

17451746
ty::Projection(_) | ty::UnnormalizedProjection(..) | ty::Bound(..) |
1746-
ty::Opaque(..) | ty::Param(_) | ty::Infer(_) | ty::Error => {
1747+
ty::Placeholder(..) | ty::Opaque(..) | ty::Param(_) | ty::Infer(_) |
1748+
ty::Error => {
17471749
bug!("TyLayout::field_type: unexpected type `{}`", this.ty)
17481750
}
17491751
})

‎src/librustc/ty/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2445,6 +2445,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
24452445
}
24462446
}
24472447

2448+
Placeholder(..) |
24482449
Bound(..) |
24492450
Infer(..) => {
24502451
bug!("unexpected type `{:?}` in sized_constraint_for_ty",

‎src/librustc/ty/outlives.rs

+1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
155155
ty::FnDef(..) | // OutlivesFunction (*)
156156
ty::FnPtr(_) | // OutlivesFunction (*)
157157
ty::Dynamic(..) | // OutlivesObject, OutlivesFragment (*)
158+
ty::Placeholder(..) |
158159
ty::Bound(..) |
159160
ty::Error => {
160161
// (*) Bare functions and traits are both binders. In the

‎src/librustc/ty/structural_impls.rs

+2
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
746746
ty::Infer(_) |
747747
ty::Param(..) |
748748
ty::Bound(..) |
749+
ty::Placeholder(..) |
749750
ty::Never |
750751
ty::Foreign(..) => return self
751752
};
@@ -792,6 +793,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
792793
ty::Error |
793794
ty::Infer(_) |
794795
ty::Bound(..) |
796+
ty::Placeholder(..) |
795797
ty::Param(..) |
796798
ty::Never |
797799
ty::Foreign(..) => false,

‎src/librustc/ty/sty.rs

+5
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ pub enum TyKind<'tcx> {
203203
/// Bound type variable, used only when preparing a trait query.
204204
Bound(BoundTy),
205205

206+
/// A placeholder type - universally quantified higher-ranked type.
207+
Placeholder(ty::PlaceholderType),
208+
206209
/// A type variable used during type checking.
207210
Infer(InferTy),
208211

@@ -1890,6 +1893,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
18901893
Foreign(..) |
18911894
Param(_) |
18921895
Bound(..) |
1896+
Placeholder(..) |
18931897
Infer(_) |
18941898
Error => {}
18951899
}
@@ -1954,6 +1958,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
19541958
ty::Infer(ty::TyVar(_)) => false,
19551959

19561960
ty::Bound(_) |
1961+
ty::Placeholder(..) |
19571962
ty::Infer(ty::FreshTy(_)) |
19581963
ty::Infer(ty::FreshIntTy(_)) |
19591964
ty::Infer(ty::FreshFloatTy(_)) =>

‎src/librustc/ty/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
952952
// Can refer to a type which may drop.
953953
// FIXME(eddyb) check this against a ParamEnv.
954954
ty::Dynamic(..) | ty::Projection(..) | ty::Param(_) | ty::Bound(..) |
955-
ty::Opaque(..) | ty::Infer(_) | ty::Error => true,
955+
ty::Placeholder(..) | ty::Opaque(..) | ty::Infer(_) | ty::Error => true,
956956

957957
ty::UnnormalizedProjection(..) => bug!("only used with chalk-engine"),
958958

‎src/librustc/ty/walk.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) {
8282
match parent_ty.sty {
8383
ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) |
8484
ty::Str | ty::Infer(_) | ty::Param(_) | ty::Never | ty::Error |
85-
ty::Bound(..) | ty::Foreign(..) => {
85+
ty::Placeholder(..) | ty::Bound(..) | ty::Foreign(..) => {
8686
}
8787
ty::Array(ty, len) => {
8888
push_const(stack, len);

‎src/librustc/ty/wf.rs

+1
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> {
259259
ty::Never |
260260
ty::Param(_) |
261261
ty::Bound(..) |
262+
ty::Placeholder(..) |
262263
ty::Foreign(..) => {
263264
// WfScalar, WfParameter, etc
264265
}

‎src/librustc/util/ppaux.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use ty::{Bool, Char, Adt};
1818
use ty::{Error, Str, Array, Slice, Float, FnDef, FnPtr};
1919
use ty::{Param, Bound, RawPtr, Ref, Never, Tuple};
2020
use ty::{Closure, Generator, GeneratorWitness, Foreign, Projection, Opaque};
21-
use ty::{UnnormalizedProjection, Dynamic, Int, Uint, Infer};
21+
use ty::{Placeholder, UnnormalizedProjection, Dynamic, Int, Uint, Infer};
2222
use ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable, GenericParamCount, GenericParamDefKind};
2323
use util::nodemap::FxHashSet;
2424

@@ -1144,6 +1144,9 @@ define_print! {
11441144
data.print(f, cx)?;
11451145
write!(f, ")")
11461146
}
1147+
Placeholder(placeholder) => {
1148+
write!(f, "Placeholder({:?})", placeholder)
1149+
}
11471150
Opaque(def_id, substs) => {
11481151
if cx.is_verbose {
11491152
return write!(f, "Opaque({:?}, {:?})", def_id, substs);

‎src/librustc_codegen_llvm/debuginfo/type_names.rs

+1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
172172
}
173173
ty::Error |
174174
ty::Infer(_) |
175+
ty::Placeholder(..) |
175176
ty::UnnormalizedProjection(..) |
176177
ty::Projection(..) |
177178
ty::Bound(..) |

‎src/librustc_lint/types.rs

+1
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
727727
ty::Closure(..) |
728728
ty::Generator(..) |
729729
ty::GeneratorWitness(..) |
730+
ty::Placeholder(..) |
730731
ty::UnnormalizedProjection(..) |
731732
ty::Projection(..) |
732733
ty::Opaque(..) |

‎src/librustc_mir/monomorphize/item.rs

+1
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
378378
ty::Error |
379379
ty::Bound(..) |
380380
ty::Infer(_) |
381+
ty::Placeholder(..) |
381382
ty::UnnormalizedProjection(..) |
382383
ty::Projection(..) |
383384
ty::Param(_) |

‎src/librustc_traits/chalk_context/program_clauses.rs

+1
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ impl ChalkInferenceContext<'cx, 'gcx, 'tcx> {
418418
}
419419

420420
ty::GeneratorWitness(..) |
421+
ty::Placeholder(..) |
421422
ty::UnnormalizedProjection(..) |
422423
ty::Infer(..) |
423424
ty::Bound(..) |

‎src/librustc_traits/dropck_outlives.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>(
274274

275275
ty::UnnormalizedProjection(..) => bug!("only used with chalk-engine"),
276276

277-
ty::Bound(..) | ty::Infer(..) | ty::Error => {
277+
ty::Placeholder(..) | ty::Bound(..) | ty::Infer(..) | ty::Error => {
278278
// By the time this code runs, all type variables ought to
279279
// be fully resolved.
280280
Err(NoSolution)

‎src/librustc_traits/lowering/environment.rs

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ impl ClauseVisitor<'set, 'a, 'tcx> {
114114
ty::Tuple(..) |
115115
ty::Never |
116116
ty::Infer(..) |
117+
ty::Placeholder(..) |
117118
ty::Bound(..) => (),
118119

119120
ty::GeneratorWitness(..) |

‎src/librustc_typeck/check/cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
128128
ty::Opaque(def_id, substs) => Some(PointerKind::OfOpaque(def_id, substs)),
129129
ty::Param(ref p) => Some(PointerKind::OfParam(p)),
130130
// Insufficient type information.
131-
ty::Bound(..) | ty::Infer(_) => None,
131+
ty::Placeholder(..) | ty::Bound(..) | ty::Infer(_) => None,
132132

133133
ty::Bool | ty::Char | ty::Int(..) | ty::Uint(..) |
134134
ty::Float(_) | ty::Array(..) | ty::GeneratorWitness(..) |

‎src/librustc_typeck/variance/constraints.rs

+1
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
336336
// types, where we use Error as the Self type
337337
}
338338

339+
ty::Placeholder(..) |
339340
ty::UnnormalizedProjection(..) |
340341
ty::GeneratorWitness(..) |
341342
ty::Bound(..) |

‎src/librustdoc/clean/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2744,6 +2744,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
27442744
ty::Closure(..) | ty::Generator(..) => Tuple(vec![]), // FIXME(pcwalton)
27452745

27462746
ty::Bound(..) => panic!("Bound"),
2747+
ty::Placeholder(..) => panic!("Placeholder"),
27472748
ty::UnnormalizedProjection(..) => panic!("UnnormalizedProjection"),
27482749
ty::GeneratorWitness(..) => panic!("GeneratorWitness"),
27492750
ty::Infer(..) => panic!("Infer"),

0 commit comments

Comments
 (0)
Please sign in to comment.