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