@@ -231,6 +231,7 @@ impl fmt::Display for ValidityRequirement {
231
231
pub enum LayoutError < ' tcx > {
232
232
Unknown ( Ty < ' tcx > ) ,
233
233
SizeOverflow ( Ty < ' tcx > ) ,
234
+ TooGeneric ( Ty < ' tcx > ) ,
234
235
NormalizationFailure ( Ty < ' tcx > , NormalizationError < ' tcx > ) ,
235
236
ReferencesError ( ErrorGuaranteed ) ,
236
237
Cycle ( ErrorGuaranteed ) ,
@@ -244,6 +245,7 @@ impl<'tcx> LayoutError<'tcx> {
244
245
match self {
245
246
Unknown ( _) => middle_unknown_layout,
246
247
SizeOverflow ( _) => middle_values_too_big,
248
+ TooGeneric ( _) => middle_too_generic,
247
249
NormalizationFailure ( _, _) => middle_cannot_be_normalized,
248
250
Cycle ( _) => middle_cycle,
249
251
ReferencesError ( _) => middle_layout_references_error,
@@ -257,6 +259,7 @@ impl<'tcx> LayoutError<'tcx> {
257
259
match self {
258
260
Unknown ( ty) => E :: Unknown { ty } ,
259
261
SizeOverflow ( ty) => E :: Overflow { ty } ,
262
+ TooGeneric ( ty) => E :: TooGeneric { ty } ,
260
263
NormalizationFailure ( ty, e) => {
261
264
E :: NormalizationFailure { ty, failure_ty : e. get_type_for_failure ( ) }
262
265
}
@@ -272,6 +275,9 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> {
272
275
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
273
276
match * self {
274
277
LayoutError :: Unknown ( ty) => write ! ( f, "the type `{ty}` has an unknown layout" ) ,
278
+ LayoutError :: TooGeneric ( ty) => {
279
+ write ! ( f, "cannot determine the layout for the type `{ty}`; too generic" )
280
+ }
275
281
LayoutError :: SizeOverflow ( ty) => {
276
282
write ! ( f, "values of the type `{ty}` are too big for the target architecture" )
277
283
}
@@ -355,6 +361,7 @@ impl<'tcx> SizeSkeleton<'tcx> {
355
361
Err (
356
362
e @ LayoutError :: Cycle ( _)
357
363
| e @ LayoutError :: SizeOverflow ( _)
364
+ | e @ LayoutError :: TooGeneric ( _)
358
365
| e @ LayoutError :: NormalizationFailure ( ..)
359
366
| e @ LayoutError :: ReferencesError ( _) ,
360
367
) => return Err ( e) ,
0 commit comments