@@ -72,6 +72,8 @@ pub type Variants = hir_def::layout::Variants<RustcFieldIdx, RustcEnumVariantIdx
72
72
73
73
#[ derive( Debug , PartialEq , Eq , Clone ) ]
74
74
pub enum LayoutError {
75
+ // FIXME: Remove variants that duplicate LayoutCalculatorError's variants after sync
76
+ BadCalc ( layout:: LayoutCalculatorError < ( ) > ) ,
75
77
EmptyUnion ,
76
78
HasErrorConst ,
77
79
HasErrorType ,
@@ -90,6 +92,7 @@ impl std::error::Error for LayoutError {}
90
92
impl fmt:: Display for LayoutError {
91
93
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
92
94
match self {
95
+ LayoutError :: BadCalc ( err) => write ! ( f, "{}" , err. fallback_fmt( ) ) ,
93
96
LayoutError :: EmptyUnion => write ! ( f, "type is an union with no fields" ) ,
94
97
LayoutError :: HasErrorConst => write ! ( f, "type contains an unevaluatable const" ) ,
95
98
LayoutError :: HasErrorType => write ! ( f, "type contains an error" ) ,
@@ -114,11 +117,7 @@ impl fmt::Display for LayoutError {
114
117
115
118
impl < F > From < LayoutCalculatorError < F > > for LayoutError {
116
119
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 ( ) )
122
121
}
123
122
}
124
123
0 commit comments