Skip to content

Commit bbe99cc

Browse files
committed
Introduce TyUnusedSubst
1 parent c1492ed commit bbe99cc

File tree

28 files changed

+50
-17
lines changed

28 files changed

+50
-17
lines changed

src/librustc/ich/impls_ty.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,8 @@ for ty::TypeVariants<'gcx>
857857
TyChar |
858858
TyStr |
859859
TyError |
860-
TyNever => {
860+
TyNever |
861+
TyUnusedParam => {
861862
// Nothing more to hash.
862863
}
863864
TyInt(int_ty) => {

src/librustc/infer/canonical.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
634634
| ty::TyProjection(..)
635635
| ty::TyForeign(..)
636636
| ty::TyParam(..)
637+
| ty::TyUnusedParam
637638
| ty::TyAnon(..) => {
638639
if t.flags.intersects(self.needs_canonical_flags) {
639640
t.super_fold_with(self)

src/librustc/infer/freshen.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
200200
ty::TyAnon(..) => {
201201
t.super_fold_with(self)
202202
}
203+
ty::TyUnusedParam => bug!("Unexpected TyUnusedParam in TypeFreshener"),
203204
}
204205
}
205206
}

src/librustc/traits/coherence.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,8 @@ fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool {
480480
ty::TyClosure(..) |
481481
ty::TyGenerator(..) |
482482
ty::TyGeneratorWitness(..) |
483-
ty::TyAnon(..) => {
483+
ty::TyAnon(..) |
484+
ty::TyUnusedParam => {
484485
bug!("ty_is_local invoked on unexpected type: {:?}", ty)
485486
}
486487
}

src/librustc/traits/error_reporting.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
263263
ty::TyGenerator(..) => Some(18),
264264
ty::TyForeign(..) => Some(19),
265265
ty::TyGeneratorWitness(..) => Some(20),
266-
ty::TyInfer(..) | ty::TyError => None
266+
ty::TyInfer(..) | ty::TyError => None,
267+
ty::TyUnusedParam => bug!("unexpected TyUnusedParam in fuzzy_match_tys"),
267268
}
268269
}
269270

src/librustc/traits/query/dropck_outlives.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,5 +261,7 @@ fn trivial_dropck_outlives<'cx, 'tcx>(tcx: TyCtxt<'cx, '_, 'tcx>, ty: Ty<'tcx>)
261261
| ty::TyAnon(..)
262262
| ty::TyInfer(_)
263263
| ty::TyGenerator(..) => false,
264+
265+
ty::TyUnusedParam => bug!("trivial_dropck_outlives called with TyUnusedParam"),
264266
}
265267
}

src/librustc/traits/select.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2039,7 +2039,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
20392039
))
20402040
}
20412041

2042-
ty::TyProjection(_) | ty::TyParam(_) | ty::TyAnon(..) => None,
2042+
ty::TyProjection(_) | ty::TyParam(_) | ty::TyUnusedParam | ty::TyAnon(..) => None,
20432043
ty::TyInfer(ty::TyVar(_)) => Ambiguous,
20442044

20452045
ty::TyInfer(ty::CanonicalTy(_)) |
@@ -2120,6 +2120,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
21202120
bug!("asked to assemble builtin bounds of unexpected type: {:?}",
21212121
self_ty);
21222122
}
2123+
ty::TyUnusedParam => bug!("Unexpected TyUnusedParam in copy_clone_conditions"),
21232124
}
21242125
}
21252126

@@ -2155,6 +2156,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
21552156
ty::TyParam(..) |
21562157
ty::TyForeign(..) |
21572158
ty::TyProjection(..) |
2159+
ty::TyUnusedParam |
21582160
ty::TyInfer(ty::CanonicalTy(_)) |
21592161
ty::TyInfer(ty::TyVar(_)) |
21602162
ty::TyInfer(ty::FreshTy(_)) |

src/librustc/ty/context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,13 +1947,15 @@ macro_rules! sty_debug_print {
19471947
region_infer: 0, ty_infer: 0, both_infer: 0,
19481948
};
19491949
$(let mut $variant = total;)*
1950+
let mut TyUnusedParam = total;
19501951

19511952

19521953
for &Interned(t) in tcx.interners.type_.borrow().iter() {
19531954
let variant = match t.sty {
19541955
ty::TyBool | ty::TyChar | ty::TyInt(..) | ty::TyUint(..) |
19551956
ty::TyFloat(..) | ty::TyStr | ty::TyNever => continue,
19561957
ty::TyError => /* unimportant */ continue,
1958+
ty::TyUnusedParam => &mut TyUnusedParam,
19571959
$(ty::$variant(..) => &mut $variant,)*
19581960
};
19591961
let region = t.flags.intersects(ty::TypeFlags::HAS_RE_INFER);

src/librustc/ty/error.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> {
232232
"type parameter".to_string()
233233
}
234234
}
235+
ty::TyUnusedParam => "unused type parameter".to_string(),
235236
ty::TyAnon(..) => "anonymized type".to_string(),
236237
ty::TyError => "type error".to_string(),
237238
}

src/librustc/ty/fast_reject.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
121121
ty::TyForeign(def_id) => {
122122
Some(ForeignSimplifiedType(def_id))
123123
}
124-
ty::TyInfer(_) | ty::TyError => None,
124+
ty::TyInfer(_) | ty::TyError | ty::TyUnusedParam => None,
125125
}
126126
}
127127

0 commit comments

Comments
 (0)