@@ -10,7 +10,7 @@ use rustc_hir::def_id::DefId;
10
10
use rustc_index:: IndexVec ;
11
11
use rustc_session:: config:: OptLevel ;
12
12
use rustc_span:: symbol:: { sym, Symbol } ;
13
- use rustc_span:: { Span , DUMMY_SP } ;
13
+ use rustc_span:: { ErrorGuaranteed , Span , DUMMY_SP } ;
14
14
use rustc_target:: abi:: call:: FnAbi ;
15
15
use rustc_target:: abi:: * ;
16
16
use rustc_target:: spec:: { abi:: Abi as SpecAbi , HasTargetSpec , PanicStrategy , Target } ;
@@ -212,6 +212,7 @@ pub enum LayoutError<'tcx> {
212
212
Unknown ( Ty < ' tcx > ) ,
213
213
SizeOverflow ( Ty < ' tcx > ) ,
214
214
NormalizationFailure ( Ty < ' tcx > , NormalizationError < ' tcx > ) ,
215
+ ReferencesError ( ErrorGuaranteed ) ,
215
216
Cycle ,
216
217
}
217
218
@@ -224,6 +225,7 @@ impl<'tcx> LayoutError<'tcx> {
224
225
SizeOverflow ( _) => middle_values_too_big,
225
226
NormalizationFailure ( _, _) => middle_cannot_be_normalized,
226
227
Cycle => middle_cycle,
228
+ ReferencesError ( _) => middle_layout_references_error,
227
229
}
228
230
}
229
231
@@ -237,6 +239,7 @@ impl<'tcx> LayoutError<'tcx> {
237
239
E :: NormalizationFailure { ty, failure_ty : e. get_type_for_failure ( ) }
238
240
}
239
241
Cycle => E :: Cycle ,
242
+ ReferencesError ( _) => E :: ReferencesError ,
240
243
}
241
244
}
242
245
}
@@ -257,6 +260,7 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> {
257
260
e. get_type_for_failure( )
258
261
) ,
259
262
LayoutError :: Cycle => write ! ( f, "a cycle occurred during layout computation" ) ,
263
+ LayoutError :: ReferencesError ( _) => write ! ( f, "the type has an unknown layout" ) ,
260
264
}
261
265
}
262
266
}
@@ -323,7 +327,8 @@ impl<'tcx> SizeSkeleton<'tcx> {
323
327
Err (
324
328
e @ LayoutError :: Cycle
325
329
| e @ LayoutError :: SizeOverflow ( _)
326
- | e @ LayoutError :: NormalizationFailure ( ..) ,
330
+ | e @ LayoutError :: NormalizationFailure ( ..)
331
+ | e @ LayoutError :: ReferencesError ( _) ,
327
332
) => return Err ( e) ,
328
333
} ;
329
334
0 commit comments