rust/compiler
Stuart Cook 35a82b8dde
Rollup merge of #148878 - folkertdev:tail-call-unsupported-abi, r=WaffleLapkin
error when ABI does not support guaranteed tail calls

Some ABIs cannot support guaranteed tail calls. There isn't really an exhaustive list, so this is a best effort. Conveniently, we already disallow calling most of these directly anyway. The only exception that I was able to trigger an LLVM assertion with so far was `cmse-nonsecure-entry`.

For that calling convention, LLVM specifically notes that  (guaranteed) tail calls cannot be supported:

28dbbba6c3/llvm/lib/Target/ARM/ARMISelLowering.cpp (L2331-L2335)

---

I have some doubts about the implementation here though. I think it would be nicer to use `CanonAbi`, and move the `become` ABI check into `rustc_hir_typeck`, similar to `check_call_abi`:

d6deffe2de/compiler/rustc_hir_typeck/src/callee.rs (L157-L194)

Both the check for whether an ABI is callable and whether it supports guaranteed tail calls can then be methods (containing exhaustive matches) on `CanonAbi`. I'm however not sure

- if the ABI checks are deliberately only performed when constructing MIR
- what assumptions can be made about the `call` expression in [`check_expr_become`](d6deffe2de/compiler/rustc_hir_typeck/src/expr.rs (L1126-L1150)), it looks like currently the check that the "argument" to `become` is a function call also only occurs later during MIR construction

Are there issues with validating the ABI earlier in `rustc_hir_typeck` that I'm overlooking? I believe that we should already know the call's ABI and whether it is c-variadic at that point.

cc ````@workingjubilee```` for `CanonAbi`, ````@davidtwco```` for cmse
r? ````@WaffleLapkin````
2025-11-14 13:14:04 +11:00
..
rustc Revert "Rollup merge of #146627 - madsmtm:jemalloc-simplify, r=jdonszelmann" 2025-11-13 10:29:26 +01:00
rustc_abi error when ABI does not support guaranteed tail calls 2025-11-13 15:31:37 +01:00
rustc_arena Allow internal_features lint in doc tests 2025-11-05 11:25:29 +00:00
rustc_ast Rollup merge of #148770 - folkertdev:naked-c-variadic, r=workingjubilee 2025-11-12 12:26:40 +11:00
rustc_ast_ir Implement &pin patterns and ref pin bindings 2025-11-10 09:57:08 +08:00
rustc_ast_lowering Simplify loop in format_args lowering. 2025-11-12 14:56:58 +01:00
rustc_ast_passes Rollup merge of #148770 - folkertdev:naked-c-variadic, r=workingjubilee 2025-11-12 12:26:40 +11:00
rustc_ast_pretty Implement &pin patterns and ref pin bindings 2025-11-10 09:57:08 +08:00
rustc_attr_parsing Auto merge of #148818 - Zalathar:rollup-4vujcg0, r=Zalathar 2025-11-11 13:30:50 +00:00
rustc_baked_icu_data Unify the configuration of the compiler docs 2025-11-05 11:25:27 +00:00
rustc_borrowck Auto merge of #148552 - chenyukang:yukang-fix-148392-closure-diag, r=petrochenkov 2025-11-12 14:32:06 +00:00
rustc_builtin_macros Rollup merge of #148712 - JonathanBrouwer:cfg_select, r=jdonszelmann 2025-11-11 21:11:48 +11:00
rustc_codegen_cranelift rustc_target: introduce Os 2025-11-11 18:55:40 -05:00
rustc_codegen_gcc Auto merge of #148481 - GuillaumeGomez:subtree-update_cg_gcc_2025-11-04, r=GuillaumeGomez 2025-11-13 18:00:02 +00:00
rustc_codegen_llvm Remove unused LLVMModuleRef argument 2025-11-12 15:46:08 +00:00
rustc_codegen_ssa Rollup merge of #148839 - luca3s:rtsan_ice_fix, r=WaffleLapkin 2025-11-13 11:57:08 +11:00
rustc_const_eval Rollup merge of #148683 - fmease:rm-const_trait-attr, r=fee1-dead 2025-11-09 17:37:05 +01:00
rustc_data_structures Auto merge of #148818 - Zalathar:rollup-4vujcg0, r=Zalathar 2025-11-11 13:30:50 +00:00
rustc_driver Unify the configuration of the compiler docs 2025-11-05 11:25:27 +00:00
rustc_driver_impl Fix new function_casts_as_integer lint errors in core, std, panic_unwind and compiler crates 2025-11-10 16:38:28 +01:00
rustc_error_codes Unify the configuration of the compiler docs 2025-11-05 11:25:27 +00:00
rustc_error_messages Unify the configuration of the compiler docs 2025-11-05 11:25:27 +00:00
rustc_errors Rollup merge of #148735 - chenyukang:yukang-fix-ice-148732, r=nnethercote 2025-11-13 11:57:07 +11:00
rustc_expand Rollup merge of #148808 - nnethercote:resolve-cleanups, r=chenyukang,petrochenkov 2025-11-14 13:14:00 +11:00
rustc_feature Rollup merge of #148770 - folkertdev:naked-c-variadic, r=workingjubilee 2025-11-12 12:26:40 +11:00
rustc_fluent_macro Unify the configuration of the compiler docs 2025-11-05 11:25:27 +00:00
rustc_fs_util Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_graphviz Allow internal_features lint in doc tests 2025-11-05 11:25:29 +00:00
rustc_hashes some cleanups in compiler 2025-10-12 08:08:30 +00:00
rustc_hir New format_args!()+fmt::Arguments implementation. 2025-11-12 12:45:40 +01:00
rustc_hir_analysis Auto merge of #148658 - dianne:cleanup-rvalue-scopes, r=cjgillot 2025-11-11 17:23:11 +00:00
rustc_hir_id rustc_hir_id: Add a comment explaining why the crate exists 2025-08-20 15:04:00 -07:00
rustc_hir_pretty Implement &pin patterns and ref pin bindings 2025-11-10 09:57:08 +08:00
rustc_hir_typeck Rollup merge of #147753 - chenyukang:yukang-147749, r=fmease 2025-11-12 12:26:35 +11:00
rustc_incremental Unify the configuration of the compiler docs 2025-11-05 11:25:27 +00:00
rustc_index Unify the configuration of the compiler docs 2025-11-05 11:25:27 +00:00
rustc_index_macros Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_infer Unify the configuration of the compiler docs 2025-11-05 11:25:27 +00:00
rustc_interface Add -Zannotate-moves for profiler visibility of move/copy operations 2025-11-06 15:39:45 -08:00
rustc_lexer Update memchr to 2.7.6 2025-09-26 17:53:49 +02:00
rustc_lint Rollup merge of #148770 - folkertdev:naked-c-variadic, r=workingjubilee 2025-11-12 12:26:40 +11:00
rustc_lint_defs c_variadic: Add future-incompatibility warning for ... arguments without a pattern outside of extern blocks 2025-11-10 14:33:56 +01:00
rustc_llvm Remove unused LLVMModuleRef argument 2025-11-12 15:46:08 +00:00
rustc_log Restrict sysroot crate imports to those defined in this repo. 2025-10-15 13:17:25 +01:00
rustc_macros use declarative macro for #[derive(TryFromU32)] 2025-10-06 14:54:38 +00:00
rustc_metadata rustc_target: introduce Os 2025-11-11 18:55:40 -05:00
rustc_middle Auto merge of #148658 - dianne:cleanup-rvalue-scopes, r=cjgillot 2025-11-11 17:23:11 +00:00
rustc_mir_build Rollup merge of #148878 - folkertdev:tail-call-unsupported-abi, r=WaffleLapkin 2025-11-14 13:14:04 +11:00
rustc_mir_dataflow Rollup merge of #128666 - pitaj:intrinsic-overflow_checks, r=BoxyUwU 2025-11-09 13:22:23 +11:00
rustc_mir_transform coverage: Associate hole spans with expansion tree nodes 2025-11-11 14:35:52 +11:00
rustc_monomorphize error on non-rustic ABIs using unsized parameters 2025-11-05 12:12:10 +01:00
rustc_next_trait_solver add test for assoc type norm wf check 2025-11-11 11:05:47 +01:00
rustc_parse Auto merge of #148818 - Zalathar:rollup-4vujcg0, r=Zalathar 2025-11-11 13:30:50 +00:00
rustc_parse_format Allow internal_features lint in doc tests 2025-11-05 11:25:29 +00:00
rustc_passes Rollup merge of #148770 - folkertdev:naked-c-variadic, r=workingjubilee 2025-11-12 12:26:40 +11:00
rustc_pattern_analysis fix: Do not ICE when missing match arm with ill-formed subty is met 2025-11-13 01:36:35 +09:00
rustc_privacy Unify the configuration of the compiler docs 2025-11-05 11:25:27 +00:00
rustc_proc_macro Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_public Rollup merge of #128666 - pitaj:intrinsic-overflow_checks, r=BoxyUwU 2025-11-09 13:22:23 +11:00
rustc_public_bridge Allow internal_features lint in doc tests 2025-11-05 11:25:29 +00:00
rustc_query_impl Unify the configuration of the compiler docs 2025-11-05 11:25:27 +00:00
rustc_query_system fix dev guide link in rustc_query_system/dep_graph/README.MD 2025-11-06 17:17:03 +05:00
rustc_resolve Rollup merge of #148808 - nnethercote:resolve-cleanups, r=chenyukang,petrochenkov 2025-11-14 13:14:00 +11:00
rustc_sanitizers Rollup merge of #144936 - rcvalle:rust-cfi-fix-144641, r=lcnr 2025-10-28 20:39:32 +11:00
rustc_serialize Allow internal_features lint in doc tests 2025-11-05 11:25:29 +00:00
rustc_session rustc_target: introduce Os 2025-11-11 18:55:40 -05:00
rustc_span New format_args!()+fmt::Arguments implementation. 2025-11-12 12:45:40 +01:00
rustc_symbol_mangling Unify the configuration of the compiler docs 2025-11-05 11:25:27 +00:00
rustc_target Rollup merge of #148819 - bjorn3:fix_fixme, r=jieyouxu 2025-11-12 12:26:41 +11:00
rustc_thread_pool some cleanups in compiler 2025-10-12 08:08:30 +00:00
rustc_trait_selection Auto merge of #144674 - rperier:add_note_if_a_type_impl_a_trait_with_the_same_name, r=lcnr 2025-11-11 21:54:08 +00:00
rustc_traits add const_of_item query and use it in normalization 2025-11-08 13:50:47 -05:00
rustc_transmute prefer to use repeat_n over repeat and take 2025-10-09 01:24:55 +08:00
rustc_ty_utils Unify the configuration of the compiler docs 2025-11-05 11:25:27 +00:00
rustc_type_ir Auto merge of #135634 - joboet:trivial-clone, r=Mark-Simulacrum 2025-11-10 15:41:43 +00:00
rustc_type_ir_macros compiler: Fix a couple issues around cargo feature unification 2025-10-31 14:14:05 -04:00
rustc_windows_rc [win] Use find-msvc-tools instead of cc to find the linker and rc on Windows 2025-09-19 12:00:30 -07:00