@@ -72,6 +72,8 @@ pub type Variants = hir_def::layout::Variants<RustcFieldIdx, RustcEnumVariantIdx
7272
7373#[ derive( Debug , PartialEq , Eq , Clone ) ]
7474pub enum LayoutError {
75+ // FIXME: Remove variants that duplicate LayoutCalculatorError's variants after sync
76+ BadCalc ( layout:: LayoutCalculatorError < ( ) > ) ,
7577 EmptyUnion ,
7678 HasErrorConst ,
7779 HasErrorType ,
@@ -90,6 +92,7 @@ impl std::error::Error for LayoutError {}
9092impl fmt:: Display for LayoutError {
9193 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
9294 match self {
95+ LayoutError :: BadCalc ( err) => err. fallback_fmt ( f) ,
9396 LayoutError :: EmptyUnion => write ! ( f, "type is an union with no fields" ) ,
9497 LayoutError :: HasErrorConst => write ! ( f, "type contains an unevaluatable const" ) ,
9598 LayoutError :: HasErrorType => write ! ( f, "type contains an error" ) ,
@@ -114,11 +117,7 @@ impl fmt::Display for LayoutError {
114117
115118impl < F > From < LayoutCalculatorError < F > > for LayoutError {
116119 fn from ( err : LayoutCalculatorError < F > ) -> Self {
117- match err {
118- LayoutCalculatorError :: EmptyUnion => LayoutError :: EmptyUnion ,
119- LayoutCalculatorError :: UnexpectedUnsized ( _) => LayoutError :: UnexpectedUnsized ,
120- LayoutCalculatorError :: SizeOverflow => LayoutError :: SizeOverflow ,
121- }
120+ LayoutError :: BadCalc ( err. without_payload ( ) )
122121 }
123122}
124123
0 commit comments