rust/compiler
Matthias Krüger bb45ea3acc
Rollup merge of #146342 - folkertdev:c-variadic-errors-take-3, r=workingjubilee
Improve C-variadic error messages: part 2

tracking issue: https://github.com/rust-lang/rust/issues/44930

a reimplementation of https://github.com/rust-lang/rust/pull/143546 that builds on https://github.com/rust-lang/rust/pull/146165.

This PR

- disallows coroutines (e.g. `async fn`) from having a `...` argument
- disallows associated functions (both in traits and standard impl blocks) from having a `...` argument
- splits up a generic "ill-formed C-variadic function" into specific errors about using an incorrect ABI, not specifying an ABI, or missing the unsafe keyword

C-variadic coroutines probably don't make sense? C-variadic functions are for FFI purposes, combining that with async functions seems weird.

For associated functions, we're just cutting scope. It's probably fine, but it's probably better to explicitly allow it. So for now, at least give a more targeted error message.

Made to be reviewed commit-by-commit.

cc `@workingjubilee`
r? compiler
2025-09-10 20:29:10 +02:00
..
rustc compiler: Add Windows resources to rustc-main and rustc_driver 2025-09-05 14:06:31 -04:00
rustc_abi Rollup merge of #144066 - RalfJung:extern-c-variadics, r=workingjubilee 2025-09-02 17:08:52 +02:00
rustc_arena Introduce Arena::try_alloc_from_iter. 2025-04-19 01:13:18 +00:00
rustc_ast c-variadic: reject functions with unsupported extern ABI 2025-09-09 21:38:38 +02:00
rustc_ast_ir turn pointer width into an integer in target.json 2025-08-27 23:44:49 +02:00
rustc_ast_lowering Rollup merge of #145879 - Bryanskiy:supertraits-2, r=lcnr 2025-09-10 20:29:05 +02:00
rustc_ast_passes c-variadic: reject functions with unsupported extern ABI 2025-09-09 21:38:38 +02:00
rustc_ast_pretty Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_attr_parsing Rollup merge of #146178 - folkertdev:static-align, r=jdonszelmann,ralfjung,traviscross 2025-09-10 14:17:38 +02:00
rustc_baked_icu_data Use default locale fallback data 2025-08-28 09:48:54 +00:00
rustc_borrowck erase_regions to erase_and_anonymize_regions 2025-09-09 14:49:16 +02:00
rustc_builtin_macros Rollup merge of #146340 - fmease:frontmatter-containment, r=fee1-dead,Urgau 2025-09-10 20:29:09 +02:00
rustc_codegen_cranelift Auto merge of #146233 - jieyouxu:run-make-fission, r=Kobzol 2025-09-06 18:37:35 +00:00
rustc_codegen_gcc Rollup merge of #146178 - folkertdev:static-align, r=jdonszelmann,ralfjung,traviscross 2025-09-10 14:17:38 +02:00
rustc_codegen_llvm Rollup merge of #146178 - folkertdev:static-align, r=jdonszelmann,ralfjung,traviscross 2025-09-10 14:17:38 +02:00
rustc_codegen_ssa Auto merge of #146018 - lambdageek:add-winres-version, r=wesleywiser 2025-09-09 03:56:41 +00:00
rustc_const_eval Rollup merge of #146178 - folkertdev:static-align, r=jdonszelmann,ralfjung,traviscross 2025-09-10 14:17:38 +02:00
rustc_data_structures Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_driver compiler: Add Windows resources to rustc-main and rustc_driver 2025-09-05 14:06:31 -04:00
rustc_driver_impl Strip frontmatter in fewer places 2025-09-09 19:49:40 +02:00
rustc_error_codes Changes to the uitests 2025-08-27 20:25:18 +02:00
rustc_error_messages Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_errors fix: Filter suggestion parts that match existing code 2025-09-04 17:42:13 -06:00
rustc_expand Rollup merge of #146340 - fmease:frontmatter-containment, r=fee1-dead,Urgau 2025-09-10 20:29:09 +02:00
rustc_feature allow #[rustc_align_static(N)] on statics 2025-09-09 21:54:54 +02:00
rustc_fluent_macro Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_fs_util Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_graphviz
rustc_hashes
rustc_hir Rollup merge of #144765 - Qelxiros:range-inclusive-last, r=jhpratt 2025-09-10 14:17:37 +02:00
rustc_hir_analysis Default auto traits: revert to the default supertraits 2025-09-10 15:08:06 +03: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 Rollup merge of #146102 - fmease:rm-dead-eff-code-iii, r=fee1-dead 2025-09-02 17:08:58 +02:00
rustc_hir_typeck Driveby fixes 2025-09-09 14:49:16 +02:00
rustc_incremental Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_index Rollup merge of #144765 - Qelxiros:range-inclusive-last, r=jhpratt 2025-09-10 14:17:37 +02:00
rustc_index_macros Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_infer erase_regions to erase_and_anonymize_regions 2025-09-09 14:49:16 +02:00
rustc_interface Rollup merge of #146340 - fmease:frontmatter-containment, r=fee1-dead,Urgau 2025-09-10 20:29:09 +02:00
rustc_lexer Rollup merge of #146106 - epage:whitespace, r=fee1-dead 2025-09-03 23:08:10 +10:00
rustc_lint Default auto traits: revert to the default supertraits 2025-09-10 15:08:06 +03:00
rustc_lint_defs Rollup merge of #145932 - JamieCunliffe:target-feature-inlining, r=jackh726 2025-09-04 10:01:55 +10:00
rustc_llvm Auto merge of #146360 - Zalathar:rollup-qc2hhrd, r=Zalathar 2025-09-09 11:54:44 +00:00
rustc_log Update tracing, again 2025-09-08 09:23:37 -07:00
rustc_macros Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_metadata Auto merge of #138736 - azhogin:azhogin/sanitizers-target-modificators, r=rcvalle 2025-09-04 22:51:33 +00:00
rustc_middle Rollup merge of #146391 - beepster4096:trimnt, r=saethlin 2025-09-10 14:17:40 +02:00
rustc_mir_build Driveby fixes 2025-09-09 14:49:16 +02:00
rustc_mir_dataflow erase_regions to erase_and_anonymize_regions 2025-09-09 14:49:16 +02:00
rustc_mir_transform Auto merge of #145717 - BoxyUwU:erase_regions_rename, r=lcnr 2025-09-09 15:04:44 +00:00
rustc_monomorphize Auto merge of #145717 - BoxyUwU:erase_regions_rename, r=lcnr 2025-09-09 15:04:44 +00:00
rustc_next_trait_solver Auto merge of #140375 - lcnr:subrelations-infcx, r=BoxyUwU 2025-09-08 19:39:36 +00:00
rustc_parse Rollup merge of #146340 - fmease:frontmatter-containment, r=fee1-dead,Urgau 2025-09-10 20:29:09 +02:00
rustc_parse_format Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_passes Rollup merge of #146178 - folkertdev:static-align, r=jdonszelmann,ralfjung,traviscross 2025-09-10 14:17:38 +02:00
rustc_pattern_analysis Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_privacy Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_proc_macro Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_public Rollup merge of #146102 - fmease:rm-dead-eff-code-iii, r=fee1-dead 2025-09-02 17:08:58 +02:00
rustc_public_bridge Remove useless lifetime parameter. 2025-07-23 23:54:37 +00:00
rustc_query_impl fixup limit handling code 2025-09-08 15:07:12 -07:00
rustc_query_system fixup limit handling code 2025-09-08 15:07:12 -07:00
rustc_resolve Rollup merge of #146254 - yotamofek:pr/itertools-all-equal-value, r=cjgillot 2025-09-07 08:18:59 +02:00
rustc_sanitizers Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_serialize Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_session fixup limit handling code 2025-09-08 15:07:12 -07:00
rustc_span Rollup merge of #146311 - nnethercote:symbol-comments, r=petrochenkov 2025-09-10 20:29:06 +02:00
rustc_symbol_mangling Add assertion 2025-09-09 14:49:16 +02:00
rustc_target Rollup merge of #145709 - heiher:issue-145692-1, r=jackh726 2025-09-05 01:53:20 -04:00
rustc_thread_pool Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_trait_selection Auto merge of #145717 - BoxyUwU:erase_regions_rename, r=lcnr 2025-09-09 15:04:44 +00:00
rustc_traits erase_regions to erase_and_anonymize_regions 2025-09-09 14:49:16 +02:00
rustc_transmute Driveby fixes 2025-09-09 14:49:16 +02:00
rustc_ty_utils Auto merge of #145717 - BoxyUwU:erase_regions_rename, r=lcnr 2025-09-09 15:04:44 +00:00
rustc_type_ir Auto merge of #146375 - matthiaskrgr:rollup-utik9zj, r=matthiaskrgr 2025-09-09 18:14:23 +00:00
rustc_type_ir_macros Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00
rustc_windows_rc compiler: Add Windows resources to rustc-main and rustc_driver 2025-09-05 14:06:31 -04:00