@@ -2,6 +2,7 @@ use crate::abi::{self, Abi, Align, FieldsShape, Size};
22use crate :: abi:: { HasDataLayout , TyAbiInterface , TyAndLayout } ;
33use crate :: spec:: { self , HasTargetSpec } ;
44use rustc_span:: Symbol ;
5+ use std:: fmt;
56use std:: str:: FromStr ;
67
78mod aarch64;
@@ -515,12 +516,20 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
515516
516517/// Information about how to pass an argument to,
517518/// or return a value from, a function, under some ABI.
518- #[ derive( Clone , PartialEq , Eq , Hash , Debug , HashStable_Generic ) ]
519+ #[ derive( Clone , PartialEq , Eq , Hash , HashStable_Generic ) ]
519520pub struct ArgAbi < ' a , Ty > {
520521 pub layout : TyAndLayout < ' a , Ty > ,
521522 pub mode : PassMode ,
522523}
523524
525+ // Needs to be a custom impl because of the bounds on the `TyAndLayout` debug impl.
526+ impl < ' a , Ty : fmt:: Display > fmt:: Debug for ArgAbi < ' a , Ty > {
527+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
528+ let ArgAbi { layout, mode } = self ;
529+ f. debug_struct ( "ArgAbi" ) . field ( "layout" , layout) . field ( "mode" , mode) . finish ( )
530+ }
531+ }
532+
524533impl < ' a , Ty > ArgAbi < ' a , Ty > {
525534 /// This defines the "default ABI" for that type, that is then later adjusted in `fn_abi_adjust_for_abi`.
526535 pub fn new (
@@ -694,7 +703,7 @@ impl RiscvInterruptKind {
694703///
695704/// I will do my best to describe this structure, but these
696705/// comments are reverse-engineered and may be inaccurate. -NDM
697- #[ derive( Clone , PartialEq , Eq , Hash , Debug , HashStable_Generic ) ]
706+ #[ derive( Clone , PartialEq , Eq , Hash , HashStable_Generic ) ]
698707pub struct FnAbi < ' a , Ty > {
699708 /// The LLVM types of each argument.
700709 pub args : Box < [ ArgAbi < ' a , Ty > ] > ,
@@ -715,6 +724,21 @@ pub struct FnAbi<'a, Ty> {
715724 pub can_unwind : bool ,
716725}
717726
727+ // Needs to be a custom impl because of the bounds on the `TyAndLayout` debug impl.
728+ impl < ' a , Ty : fmt:: Display > fmt:: Debug for FnAbi < ' a , Ty > {
729+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
730+ let FnAbi { args, ret, c_variadic, fixed_count, conv, can_unwind } = self ;
731+ f. debug_struct ( "FnAbi" )
732+ . field ( "args" , args)
733+ . field ( "ret" , ret)
734+ . field ( "c_variadic" , c_variadic)
735+ . field ( "fixed_count" , fixed_count)
736+ . field ( "conv" , conv)
737+ . field ( "can_unwind" , can_unwind)
738+ . finish ( )
739+ }
740+ }
741+
718742/// Error produced by attempting to adjust a `FnAbi`, for a "foreign" ABI.
719743#[ derive( Copy , Clone , Debug , HashStable_Generic ) ]
720744pub enum AdjustForForeignAbiError {
0 commit comments