@@ -625,13 +625,6 @@ fn try_inlining<'tcx, I: Inliner<'tcx>>(
625
625
return Err ( "implementation limitation -- return type mismatch" ) ;
626
626
}
627
627
if callsite. fn_sig . abi ( ) == ExternAbi :: RustCall {
628
- // FIXME: Don't inline user-written `extern "rust-call"` functions,
629
- // since this is generally perf-negative on rustc, and we hope that
630
- // LLVM will inline these functions instead.
631
- if callee_body. spread_arg . is_some ( ) {
632
- return Err ( "user-written rust-call functions" ) ;
633
- }
634
-
635
628
let ( self_arg, arg_tuple) = match & args[ ..] {
636
629
[ arg_tuple] => ( None , arg_tuple) ,
637
630
[ self_arg, arg_tuple] => ( Some ( self_arg) , arg_tuple) ,
@@ -641,18 +634,23 @@ fn try_inlining<'tcx, I: Inliner<'tcx>>(
641
634
let self_arg_ty = self_arg. map ( |self_arg| self_arg. node . ty ( & caller_body. local_decls , tcx) ) ;
642
635
643
636
let arg_tuple_ty = arg_tuple. node . ty ( & caller_body. local_decls , tcx) ;
644
- let ty:: Tuple ( arg_tuple_tys) = * arg_tuple_ty. kind ( ) else {
645
- bug ! ( "Closure arguments are not passed as a tuple" ) ;
637
+ let arg_tys = if callee_body. spread_arg . is_some ( ) {
638
+ std:: slice:: from_ref ( & arg_tuple_ty)
639
+ } else {
640
+ let ty:: Tuple ( arg_tuple_tys) = * arg_tuple_ty. kind ( ) else {
641
+ bug ! ( "Closure arguments are not passed as a tuple" ) ;
642
+ } ;
643
+ arg_tuple_tys. as_slice ( )
646
644
} ;
647
645
648
646
for ( arg_ty, input) in
649
- self_arg_ty. into_iter ( ) . chain ( arg_tuple_tys ) . zip ( callee_body. args_iter ( ) )
647
+ self_arg_ty. into_iter ( ) . chain ( arg_tys . iter ( ) . copied ( ) ) . zip ( callee_body. args_iter ( ) )
650
648
{
651
649
let input_type = callee_body. local_decls [ input] . ty ;
652
650
if !util:: sub_types ( tcx, inliner. typing_env ( ) , input_type, arg_ty) {
653
651
trace ! ( ?arg_ty, ?input_type) ;
654
652
debug ! ( "failed to normalize tuple argument type" ) ;
655
- return Err ( "implementation limitation -- arg mismatch " ) ;
653
+ return Err ( "implementation limitation" ) ;
656
654
}
657
655
}
658
656
} else {
@@ -1059,8 +1057,7 @@ fn make_call_args<'tcx, I: Inliner<'tcx>>(
1059
1057
1060
1058
closure_ref_arg. chain ( tuple_tmp_args) . collect ( )
1061
1059
} else {
1062
- // FIXME(edition_2024): switch back to a normal method call.
1063
- <_ >:: into_iter ( args)
1060
+ args. into_iter ( )
1064
1061
. map ( |a| create_temp_if_necessary ( inliner, a. node , callsite, caller_body, return_block) )
1065
1062
. collect ( )
1066
1063
}
0 commit comments