@@ -5,7 +5,7 @@ use rustc_middle::ty::layout::{FnAbiError, LayoutError};
55use rustc_middle:: ty:: { self , GenericArgs , Instance , Ty , TyCtxt } ;
66use rustc_span:: source_map:: Spanned ;
77use rustc_span:: symbol:: sym;
8- use rustc_target:: abi:: call:: { ArgAbi , FnAbi } ;
8+ use rustc_target:: abi:: call:: FnAbi ;
99
1010use crate :: errors:: { AbiInvalidAttribute , AbiNe , AbiOf , UnrecognizedField } ;
1111
@@ -114,20 +114,6 @@ fn dump_abi_of_fn_item(tcx: TyCtxt<'_>, item_def_id: DefId, attr: &Attribute) {
114114 }
115115}
116116
117- fn test_arg_abi_eq < ' tcx > (
118- abi1 : & ' tcx ArgAbi < ' tcx , Ty < ' tcx > > ,
119- abi2 : & ' tcx ArgAbi < ' tcx , Ty < ' tcx > > ,
120- ) -> bool {
121- // Ideally we'd just compare the `mode`, but that is not enough -- for some modes LLVM will look
122- // at the type. Comparing the `mode` and `layout.abi` as well as size and alignment should catch
123- // basically everything though (except for tricky cases around unized types).
124- abi1. mode . eq_abi ( & abi2. mode )
125- && abi1. layout . abi . eq_up_to_validity ( & abi2. layout . abi )
126- && abi1. layout . size == abi2. layout . size
127- && abi1. layout . align . abi == abi2. layout . align . abi
128- && abi1. layout . is_sized ( ) == abi2. layout . is_sized ( )
129- }
130-
131117fn test_abi_eq < ' tcx > ( abi1 : & ' tcx FnAbi < ' tcx , Ty < ' tcx > > , abi2 : & ' tcx FnAbi < ' tcx , Ty < ' tcx > > ) -> bool {
132118 if abi1. conv != abi2. conv
133119 || abi1. args . len ( ) != abi2. args . len ( )
@@ -138,8 +124,8 @@ fn test_abi_eq<'tcx>(abi1: &'tcx FnAbi<'tcx, Ty<'tcx>>, abi2: &'tcx FnAbi<'tcx,
138124 return false ;
139125 }
140126
141- test_arg_abi_eq ( & abi1. ret , & abi2. ret )
142- && abi1. args . iter ( ) . zip ( abi2. args . iter ( ) ) . all ( |( arg1, arg2) | test_arg_abi_eq ( arg1, arg2) )
127+ abi1. ret . eq_abi ( & abi2. ret )
128+ && abi1. args . iter ( ) . zip ( abi2. args . iter ( ) ) . all ( |( arg1, arg2) | arg1. eq_abi ( arg2) )
143129}
144130
145131fn dump_abi_of_fn_type ( tcx : TyCtxt < ' _ > , item_def_id : DefId , attr : & Attribute ) {
0 commit comments