@@ -10,7 +10,7 @@ use rustc_hir::def_id::DefId;
1010use rustc_index:: IndexVec ;
1111use rustc_session:: config:: OptLevel ;
1212use rustc_span:: symbol:: { sym, Symbol } ;
13- use rustc_span:: { Span , DUMMY_SP } ;
13+ use rustc_span:: { ErrorGuaranteed , Span , DUMMY_SP } ;
1414use rustc_target:: abi:: call:: FnAbi ;
1515use rustc_target:: abi:: * ;
1616use rustc_target:: spec:: { abi:: Abi as SpecAbi , HasTargetSpec , PanicStrategy , Target } ;
@@ -212,6 +212,7 @@ pub enum LayoutError<'tcx> {
212212 Unknown ( Ty < ' tcx > ) ,
213213 SizeOverflow ( Ty < ' tcx > ) ,
214214 NormalizationFailure ( Ty < ' tcx > , NormalizationError < ' tcx > ) ,
215+ ReferencesError ( ErrorGuaranteed ) ,
215216 Cycle ,
216217}
217218
@@ -224,6 +225,7 @@ impl<'tcx> LayoutError<'tcx> {
224225 SizeOverflow ( _) => middle_values_too_big,
225226 NormalizationFailure ( _, _) => middle_cannot_be_normalized,
226227 Cycle => middle_cycle,
228+ ReferencesError ( _) => middle_layout_references_error,
227229 }
228230 }
229231
@@ -237,6 +239,7 @@ impl<'tcx> LayoutError<'tcx> {
237239 E :: NormalizationFailure { ty, failure_ty : e. get_type_for_failure ( ) }
238240 }
239241 Cycle => E :: Cycle ,
242+ ReferencesError ( _) => E :: ReferencesError ,
240243 }
241244 }
242245}
@@ -257,6 +260,7 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> {
257260 e. get_type_for_failure( )
258261 ) ,
259262 LayoutError :: Cycle => write ! ( f, "a cycle occurred during layout computation" ) ,
263+ LayoutError :: ReferencesError ( _) => write ! ( f, "the type has an unknown layout" ) ,
260264 }
261265 }
262266}
@@ -323,7 +327,8 @@ impl<'tcx> SizeSkeleton<'tcx> {
323327 Err (
324328 e @ LayoutError :: Cycle
325329 | e @ LayoutError :: SizeOverflow ( _)
326- | e @ LayoutError :: NormalizationFailure ( ..) ,
330+ | e @ LayoutError :: NormalizationFailure ( ..)
331+ | e @ LayoutError :: ReferencesError ( _) ,
327332 ) => return Err ( e) ,
328333 } ;
329334
0 commit comments