Skip to content

Commit 286a502

Browse files
committed
Prepare for layout use only params
1 parent be529e9 commit 286a502

File tree

29 files changed

+56
-37
lines changed

29 files changed

+56
-37
lines changed

src/librustc/ich/impls_ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ for ty::TypeVariants<'gcx>
834834
TyStr |
835835
TyError |
836836
TyNever |
837-
TyUnusedParam => {
837+
TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => {
838838
// Nothing more to hash.
839839
}
840840
TyInt(int_ty) => {

src/librustc/infer/canonical.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,8 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
635635
| ty::TyForeign(..)
636636
| ty::TyParam(..)
637637
| ty::TyAnon(..)
638-
| ty::TyUnusedParam => {
638+
| ty::TyUnusedParam
639+
| ty::TyLayoutOnlyParam(..) => {
639640
if t.flags.intersects(self.needs_canonical_flags) {
640641
t.super_fold_with(self)
641642
} else {

src/librustc/infer/freshen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +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"),
203+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => bug!("Unexpected TyUnusedParam in TypeFreshener"),
204204
}
205205
}
206206
}

src/librustc/traits/coherence.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool {
481481
ty::TyGenerator(..) |
482482
ty::TyGeneratorWitness(..) |
483483
ty::TyAnon(..) |
484-
ty::TyUnusedParam => {
484+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => {
485485
bug!("ty_is_local invoked on unexpected type: {:?}", ty)
486486
}
487487
}

src/librustc/traits/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
264264
ty::TyForeign(..) => Some(19),
265265
ty::TyGeneratorWitness(..) => Some(20),
266266
ty::TyInfer(..) | ty::TyError => None,
267-
ty::TyUnusedParam => bug!("unexpected TyUnusedParam in fuzzy_match_tys"),
267+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => bug!("unexpected TyUnusedParam in fuzzy_match_tys"),
268268
}
269269
}
270270

src/librustc/traits/query/dropck_outlives.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ fn trivial_dropck_outlives<'cx, 'tcx>(tcx: TyCtxt<'cx, '_, 'tcx>, ty: Ty<'tcx>)
262262
| ty::TyInfer(_)
263263
| ty::TyGenerator(..) => false,
264264

265-
ty::TyUnusedParam => bug!("Unexpected TyUnusedParam in trivial_dropck_outlives"),
265+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => {
266+
bug!("Unexpected {:?} in trivial_dropck_outlives", ty)
267+
}
266268
}
267269
}

src/librustc/traits/select.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,7 +2037,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
20372037
))
20382038
}
20392039

2040-
ty::TyProjection(_) | ty::TyParam(_) | ty::TyUnusedParam | ty::TyAnon(..) => None,
2040+
ty::TyProjection(_) | ty::TyParam(_) | ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) | ty::TyAnon(..) => None,
20412041
ty::TyInfer(ty::TyVar(_)) => Ambiguous,
20422042

20432043
ty::TyInfer(ty::CanonicalTy(_)) |
@@ -2114,7 +2114,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
21142114
bug!("asked to assemble builtin bounds of unexpected type: {:?}",
21152115
self_ty);
21162116
}
2117-
ty::TyUnusedParam => bug!("Unexpected TyUnusedParam in copy_clone_conditions"),
2117+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => bug!("Unexpected TyUnusedParam in copy_clone_conditions"),
21182118
}
21192119
}
21202120

@@ -2152,6 +2152,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
21522152
ty::TyProjection(..) |
21532153
ty::TyInfer(ty::CanonicalTy(_)) |
21542154
ty::TyUnusedParam |
2155+
ty::TyLayoutOnlyParam(_, _) |
21552156
ty::TyInfer(ty::TyVar(_)) |
21562157
ty::TyInfer(ty::FreshTy(_)) |
21572158
ty::TyInfer(ty::FreshIntTy(_)) |

src/librustc/ty/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1829,7 +1829,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
18291829
self,
18301830
TyAdt, TyArray, TySlice, TyRawPtr, TyRef, TyFnDef, TyFnPtr,
18311831
TyGenerator, TyGeneratorWitness, TyDynamic, TyClosure, TyTuple,
1832-
TyParam, TyInfer, TyProjection, TyAnon, TyForeign);
1832+
TyParam, TyLayoutOnlyParam, TyInfer, TyProjection, TyAnon, TyForeign);
18331833

18341834
println!("Substs interner: #{}", self.interners.substs.borrow().len());
18351835
println!("Region interner: #{}", self.interners.region.borrow().len());

src/librustc/ty/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +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(),
235+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => "unused type parameter".to_string(),
236236
ty::TyAnon(..) => "anonymized type".to_string(),
237237
ty::TyError => "type error".to_string(),
238238
}

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 | ty::TyUnusedParam => None,
124+
ty::TyInfer(_) | ty::TyError | ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => None,
125125
}
126126
}
127127

src/librustc/ty/flags.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl FlagComputation {
190190
&ty::TyFnPtr(f) => {
191191
self.add_fn_sig(f);
192192
}
193-
&ty::TyUnusedParam => bug!("Unexpected TyUnusedParam in FlagComputation::for_sty"),
193+
&ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => bug!("Unexpected TyUnusedParam in FlagComputation::for_sty"),
194194
}
195195
}
196196

src/librustc/ty/item_path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ pub fn characteristic_def_id_of_type(ty: Ty) -> Option<DefId> {
373373
ty::TyProjection(_) |
374374
ty::TyParam(_) |
375375
ty::TyAnon(..) |
376-
ty::TyUnusedParam |
376+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) |
377377
ty::TyInfer(_) |
378378
ty::TyError |
379379
ty::TyGeneratorWitness(..) |

src/librustc/ty/layout.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ pub enum Endian {
234234
}
235235

236236
/// Size of a type in bytes.
237-
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
237+
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
238238
pub struct Size {
239239
raw: u64
240240
}
@@ -1712,7 +1712,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
17121712
ty::TyParam(_) => {
17131713
return Err(LayoutError::Unknown(ty));
17141714
}
1715-
ty::TyUnusedParam | ty::TyGeneratorWitness(..) | ty::TyInfer(_) | ty::TyError => {
1715+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) | ty::TyGeneratorWitness(..) | ty::TyInfer(_) | ty::TyError => {
17161716
bug!("LayoutDetails::compute: unexpected type `{}`", ty)
17171717
}
17181718
})
@@ -2287,7 +2287,7 @@ impl<'a, 'tcx> TyLayout<'tcx> {
22872287
}
22882288
}
22892289

2290-
ty::TyProjection(_) | ty::TyAnon(..) | ty::TyParam(_) | ty::TyUnusedParam |
2290+
ty::TyProjection(_) | ty::TyAnon(..) | ty::TyParam(_) | ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) |
22912291
ty::TyInfer(_) | ty::TyError => {
22922292
bug!("TyLayout::field_type: unexpected type `{}`", self.ty)
22932293
}

src/librustc/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2069,7 +2069,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
20692069
}
20702070
}
20712071

2072-
TyUnusedParam | TyInfer(..) => {
2072+
TyUnusedParam | ty::TyLayoutOnlyParam(_, _) | TyInfer(..) => {
20732073
bug!("unexpected type `{:?}` in sized_constraint_for_ty",
20742074
ty)
20752075
}

src/librustc/ty/outlives.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
167167
self.compute_components(subty, out);
168168
}
169169
}
170-
ty::TyUnusedParam => bug!("Unexpected TyUnusedParam in compute_components"),
170+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => bug!("Unexpected TyUnusedParam in compute_components"),
171171
}
172172
}
173173

src/librustc/ty/structural_impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
865865
ty::TyAnon(did, substs) => ty::TyAnon(did, substs.fold_with(folder)),
866866
ty::TyBool | ty::TyChar | ty::TyStr | ty::TyInt(_) |
867867
ty::TyUint(_) | ty::TyFloat(_) | ty::TyError | ty::TyInfer(_) |
868-
ty::TyParam(..) | ty::TyUnusedParam | ty::TyNever | ty::TyForeign(..) => return self
868+
ty::TyParam(..) | ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) | ty::TyNever | ty::TyForeign(..) => return self
869869
};
870870

871871
if self.sty == sty {
@@ -900,7 +900,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
900900
ty::TyAnon(_, ref substs) => substs.visit_with(visitor),
901901
ty::TyBool | ty::TyChar | ty::TyStr | ty::TyInt(_) |
902902
ty::TyUint(_) | ty::TyFloat(_) | ty::TyError | ty::TyInfer(_) |
903-
ty::TyParam(..) | ty::TyUnusedParam | ty::TyNever | ty::TyForeign(..) => false,
903+
ty::TyParam(..) | ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) | ty::TyNever | ty::TyForeign(..) => false,
904904
}
905905
}
906906

src/librustc/ty/sty.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use rustc_data_structures::indexed_vec::Idx;
1818
use ty::subst::{Substs, Subst, Kind, UnpackedKind};
1919
use ty::{self, AdtDef, TypeFlags, Ty, TyCtxt, TypeFoldable};
2020
use ty::{Slice, TyS};
21+
use ty::layout::{Size, Align};
2122
use util::captures::Captures;
2223

2324
use std::iter;
@@ -167,6 +168,9 @@ pub enum TypeVariants<'tcx> {
167168
/// Substitution for a unused type parameter; see rustc_mir::monomorphize::deduplicate_instances
168169
TyUnusedParam,
169170

171+
/// Substitution for a type parameter whose size and layout is the onlything that matters
172+
TyLayoutOnlyParam(Size, Align),
173+
170174
/// A type variable used during type-checking.
171175
TyInfer(InferTy),
172176

@@ -1636,7 +1640,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
16361640
TyTuple(..) |
16371641
TyForeign(..) |
16381642
TyParam(_) |
1639-
TyUnusedParam |
1643+
TyUnusedParam | ty::TyLayoutOnlyParam(_, _) |
16401644
TyInfer(_) |
16411645
TyError => {
16421646
vec![]

src/librustc/ty/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ impl<'a, 'gcx, 'tcx, W> TypeVisitor<'tcx> for TypeIdHasher<'a, 'gcx, 'tcx, W>
734734
TySlice(_) => {}
735735

736736
// This can be generated by collapse_interchangable_instances
737-
TyUnusedParam => self.hash("<unused param>"),
737+
TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => self.hash("<unused param>"),
738738

739739
TyError |
740740
TyInfer(_) => bug!("TypeIdHasher: unexpected type {}", ty)
@@ -1126,7 +1126,7 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
11261126
|variant| variant.fields.iter().any(
11271127
|field| needs_drop(field.ty(tcx, substs)))),
11281128

1129-
ty::TyUnusedParam => bug!("Unexpected TyUnusedParam in needs_drop_raw"),
1129+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => bug!("Unexpected TyUnusedParam in needs_drop_raw"),
11301130
}
11311131
}
11321132

src/librustc/ty/walk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub fn walk_shallow<'tcx>(ty: Ty<'tcx>) -> AccIntoIter<TypeWalkerArray<'tcx>> {
8282
fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) {
8383
match parent_ty.sty {
8484
ty::TyBool | ty::TyChar | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) |
85-
ty::TyStr | ty::TyInfer(_) | ty::TyParam(_) | ty::TyUnusedParam | ty::TyNever |
85+
ty::TyStr | ty::TyInfer(_) | ty::TyParam(_) | ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) | ty::TyNever |
8686
ty::TyError | ty::TyForeign(..) => {
8787
}
8888
ty::TyArray(ty, len) => {

src/librustc/ty/wf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> {
261261
ty::TyGeneratorWitness(..) |
262262
ty::TyNever |
263263
ty::TyParam(_) |
264-
ty::TyUnusedParam |
264+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) |
265265
ty::TyForeign(..) => {
266266
// WfScalar, WfParameter, etc
267267
}

src/librustc/util/ppaux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ define_print! {
10441044
TyInfer(infer_ty) => write!(f, "{}", infer_ty),
10451045
TyError => write!(f, "[type error]"),
10461046
TyParam(ref param_ty) => write!(f, "{}", param_ty),
1047-
TyUnusedParam => write!(f, "[unused type param]"),
1047+
TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => write!(f, "[unused type param]"),
10481048
TyAdt(def, substs) => cx.parameterized(f, substs, def.did, &[]),
10491049
TyDynamic(data, r) => {
10501050
data.print(f, cx)?;

src/librustc_lint/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
705705
ty::TyForeign(..) => FfiSafe,
706706

707707
ty::TyParam(..) |
708-
ty::TyUnusedParam |
708+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) |
709709
ty::TyInfer(..) |
710710
ty::TyError |
711711
ty::TyClosure(..) |

src/librustc_mir/monomorphize/deduplicate_instances.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
// except according to those terms.
1010

1111
use rustc_data_structures::indexed_vec::IndexVec;
12-
use rustc::ty::{self, TyCtxt, Ty, ParamTy, TypeFoldable, Instance};
12+
use rustc::ty::{self, TyCtxt, Ty, TypeVariants, ParamTy, TypeFoldable, Instance, ParamEnv};
1313
use rustc::ty::fold::TypeFolder;
1414
use rustc::ty::subst::{Kind, UnpackedKind};
15+
use rustc::ty::layout::{LayoutCx, LayoutOf};
1516
use rustc::middle::const_val::ConstVal;
1617
use rustc::mir::{Mir, Rvalue, Location};
1718
use rustc::mir::visit::{Visitor, TyContext};
@@ -42,7 +43,6 @@ pub(crate) fn collapse_interchangable_instances<'a, 'tcx>(
4243
}
4344
match instance.ty(tcx).sty {
4445
ty::TyFnDef(def_id, _) => {
45-
//let attrs = tcx.item_attrs(def_id);
4646
if tcx.lang_items().items().iter().find(|l|**l == Some(def_id)).is_some() {
4747
return instance; // Lang items dont work otherwise
4848
}
@@ -51,7 +51,7 @@ pub(crate) fn collapse_interchangable_instances<'a, 'tcx>(
5151
}
5252

5353
let used_substs = used_substs_for_instance(tcx, instance);
54-
instance.substs = tcx._intern_substs(&instance.substs.into_iter().enumerate().map(|(i, subst)| {
54+
instance.substs = tcx.intern_substs(&instance.substs.into_iter().enumerate().map(|(i, subst)| {
5555
if let UnpackedKind::Type(ty) = subst.unpack() {
5656
let ty = match used_substs.parameters[ParamIdx(i as u32)] {
5757
ParamUsage::Unused => {
@@ -89,7 +89,16 @@ pub(crate) fn collapse_interchangable_instances<'a, 'tcx>(
8989
tcx.mk_ty(ty::TyNever)
9090
}
9191
}
92-
ParamUsage::LayoutUsed | ParamUsage::Used => ty.into(),
92+
ParamUsage::LayoutUsed => {
93+
let layout_cx = LayoutCx {
94+
tcx,
95+
param_env: ParamEnv::reveal_all(),
96+
};
97+
let layout = layout_cx.layout_of(ty).unwrap();
98+
let (size, align) = layout.size_and_align();
99+
tcx.mk_ty(TypeVariants::TyLayoutOnlyParam(size, align))
100+
}
101+
ParamUsage::Used => ty.into(),
93102
};
94103
Kind::from(ty)
95104
} else {

src/librustc_mir/monomorphize/item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
387387
ty::TyInfer(_) |
388388
ty::TyProjection(..) |
389389
ty::TyParam(_) |
390-
ty::TyUnusedParam |
390+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) |
391391
ty::TyGeneratorWitness(_) |
392392
ty::TyAnon(..) => {
393393
bug!("DefPathBasedNames: Trying to create type name for \

src/librustc_traits/dropck_outlives.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>(
239239
Err(NoSolution)
240240
}
241241

242-
ty::TyUnusedParam => bug!("Unexpected TyUnusedParam in dtorck_constraint_for_ty"),
242+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(..) => {
243+
bug!("Unexpected {:?} in dtorck_constraint_for_ty", ty);
244+
}
243245
};
244246

245247
debug!("dtorck_constraint_for_ty({:?}) = {:?}", ty, result);

src/librustc_trans/debuginfo/type_names.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
171171
ty::TyGenerator(..) => {
172172
output.push_str("generator");
173173
}
174-
ty::TyUnusedParam => {
174+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => {
175175
output.push_str("[unused type param]");
176176
}
177177
ty::TyError |

src/librustc_typeck/check/cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
137137
span, &format!("`{:?}` should be sized but is not?", t));
138138
return Err(ErrorReported);
139139
}
140-
ty::TyUnusedParam => bug!("Unexpected TyUnusedParam in FnCtxt::pointer_kind"),
140+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => bug!("Unexpected TyUnusedParam in FnCtxt::pointer_kind"),
141141
})
142142
}
143143
}

src/librustc_typeck/variance/constraints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
334334
// types, where we use TyError as the Self type
335335
}
336336

337-
ty::TyUnusedParam |
337+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) |
338338
ty::TyGeneratorWitness(..) |
339339
ty::TyInfer(..) => {
340340
bug!("unexpected type encountered in \

src/librustdoc/clean/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2836,7 +2836,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
28362836

28372837
ty::TyClosure(..) | ty::TyGenerator(..) => Tuple(vec![]), // FIXME(pcwalton)
28382838

2839-
ty::TyUnusedParam => panic!("TyUnusedParam"),
2839+
ty::TyUnusedParam | ty::TyLayoutOnlyParam(_, _) => panic!("TyUnusedParam"),
28402840
ty::TyGeneratorWitness(..) => panic!("TyGeneratorWitness"),
28412841
ty::TyInfer(..) => panic!("TyInfer"),
28422842
ty::TyError => panic!("TyError"),

0 commit comments

Comments
 (0)