This repository was archived by the owner on May 28, 2025. It is now read-only.
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> {
182182 /// of that field's type - this is useful for taking the address of
183183 /// that field and ensuring the struct has the right alignment.
184184 fn gcc_type < ' gcc > ( & self , cx : & CodegenCx < ' gcc , ' tcx > ) -> Type < ' gcc > {
185+ use crate :: rustc_middle:: ty:: layout:: FnAbiOf ;
185186 // This must produce the same result for `repr(transparent)` wrappers as for the inner type!
186187 // In other words, this should generally not look at the type at all, but only at the
187188 // layout.
@@ -191,7 +192,14 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
191192 if let Some ( & ty) = cx. scalar_types . borrow ( ) . get ( & self . ty ) {
192193 return ty;
193194 }
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+ } ;
195203 cx. scalar_types . borrow_mut ( ) . insert ( self . ty , ty) ;
196204 return ty;
197205 }
You can’t perform that action at this time.
0 commit comments