File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
182
182
/// of that field's type - this is useful for taking the address of
183
183
/// that field and ensuring the struct has the right alignment.
184
184
fn gcc_type < ' gcc > ( & self , cx : & CodegenCx < ' gcc , ' tcx > ) -> Type < ' gcc > {
185
+ use crate :: rustc_middle:: ty:: layout:: FnAbiOf ;
185
186
// This must produce the same result for `repr(transparent)` wrappers as for the inner type!
186
187
// In other words, this should generally not look at the type at all, but only at the
187
188
// layout.
@@ -191,7 +192,14 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
191
192
if let Some ( & ty) = cx. scalar_types . borrow ( ) . get ( & self . ty ) {
192
193
return ty;
193
194
}
194
- let ty = self . scalar_gcc_type_at ( cx, scalar, Size :: ZERO ) ;
195
+ let ty =
196
+ match * self . ty . kind ( ) {
197
+ // NOTE: we cannot remove this match like in the LLVM codegen because the call
198
+ // to fn_ptr_backend_type handle the on-stack attribute.
199
+ // TODO(antoyo): find a less hackish way to hande the on-stack attribute.
200
+ ty:: FnPtr ( sig) => cx. fn_ptr_backend_type ( & cx. fn_abi_of_fn_ptr ( sig, ty:: List :: empty ( ) ) ) ,
201
+ _ => self . scalar_gcc_type_at ( cx, scalar, Size :: ZERO ) ,
202
+ } ;
195
203
cx. scalar_types . borrow_mut ( ) . insert ( self . ty , ty) ;
196
204
return ty;
197
205
}
You can’t perform that action at this time.
0 commit comments