rust/tests/ui/mir
Stuart Cook 3538bc18fe
Rollup merge of #143619 - beetrees:varargs-named, r=jdonszelmann
`c_variadic`: Add future-incompatibility warning for `...` arguments without a pattern outside of `extern` blocks

This PR makes `...` arguments without a pattern in non-foreign functions (such as the argument in `unsafe extern "C" fn f(...) {}`) a future-compatibility warning; making this error would be consistent with how `unsafe extern "C" fn f(u32) {}` is handled. Allowing `...` arguments without a pattern in non-foreign functions is a source of confusion for programmers coming from C, where the `...` parameter is never named and instead calling `va_start` is required; disallowing `...` arguments without a pattern also improves the overall consistency of the Rust language by matching the treatment of other arguments without patterns. `...` arguments without a pattern in `extern` blocks (such as `unsafe extern "C" { fn f(...); }`) continue to compile without warnings after this PR, as they are already stable and heavily used (and don't cause the mentioned confusion as they are just being used in function declarations).

As all the syntax gating for `c_variadic` has been done post-expansion, this is technically a breaking change. In particular, code like this has compiled on stable since Rust 1.35.0:
```rust
#[cfg(any())] // Equivalent to the more recent #[cfg(false)]
unsafe extern "C" fn bar(_: u32, ...) {}
```
Since this is more or less a stability hole and a Crater run shows only the `binrw` crate is using this, I think it would be ok to break this. This will require a lang FCP.

The idea of rejecting `...` pre-expansion was first raised here https://github.com/rust-lang/rust/pull/143546#issuecomment-3043142052.

Tracking issue: rust-lang/rust#44930
cc `@folkertdev` `@workingjubilee`
r? `@joshtriplett`
2025-11-11 21:09:33 +11:00
..
alignment Revert "Rollup merge of #122661 - estebank:assert-macro-span, r=petrochenkov" 2025-09-11 09:10:46 +08:00
auxiliary Mark foo as explicitly inline. 2024-05-04 19:27:27 +00:00
enum tests: Require run-fail ui tests to have an exit code (SIGABRT not ok) 2025-07-19 18:44:07 +02:00
lint Lint overlapping assignments in MIR. 2025-09-17 21:12:17 +00:00
mir-inlining Fix mismatched quotation mark 2024-10-17 00:16:19 +08:00
null tests: Require run-fail ui tests to have an exit code (SIGABRT not ok) 2025-07-19 18:44:07 +02:00
validate Fix ICE when validating transmuting ZST to inhabited enum 2025-08-23 19:25:58 +02:00
build-async-error-body-correctly.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
build-async-error-body-correctly.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
checks_without_panic_impl.rs compiletest: rename add-core-stubs to add-minicore 2025-11-02 16:20:06 +01:00
clone-canonicalization-miscompile-132353.rs Add a regression test for #132353 2024-10-31 13:12:22 +08:00
const_eval_select_cycle.rs Teach MIR inliner query cycle avoidance about const_eval_select 2024-04-04 00:10:52 -04:00
debug-ref-undef.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
drop-elaboration-after-borrowck-error.rs Taint borrowck results without running any borrowck if the MIR body was already tainted 2024-02-08 07:39:49 +00:00
drop-elaboration-after-borrowck-error.stderr Taint borrowck results without running any borrowck if the MIR body was already tainted 2024-02-08 07:39:49 +00:00
dyn_metadata_sroa.rs Stop SRoA'ing DynMetadata in MIR 2024-05-25 00:44:47 -07:00
early-otherwise-branch-ice.rs Add regression test for #130769 2024-09-24 08:56:41 +00:00
enable_passes_validation.all_unknown.stderr Validate and test -Zmir-enable-passes 2024-11-12 13:28:05 +00:00
enable_passes_validation.empty.stderr Validate and test -Zmir-enable-passes 2024-11-12 13:28:05 +00:00
enable_passes_validation.mixed.stderr Validate and test -Zmir-enable-passes 2024-11-12 13:28:05 +00:00
enable_passes_validation.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
enable_passes_validation.unprefixed.stderr Validate and test -Zmir-enable-passes 2024-11-12 13:28:05 +00:00
field-projection-invariant.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
field-projection-mutating-context.rs only require sub type relation on field projection types 2023-02-12 23:18:15 +01:00
field-projection-mutating-context.stderr recurse into refs when comparing tys for diagnostics 2023-12-07 23:00:46 -05:00
field-projection-mutating-context2.rs only require sub type relation on field projection types 2023-02-12 23:18:15 +01:00
field-projection-mutating-context2.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
field-ty-ascription-enums.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
field-ty-ascription.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
gvn-loop-miscompile.rs GVN: Invalidate derefs at loop headers 2025-10-14 08:09:32 +08:00
gvn-nonsensical-coroutine-layout.rs Move crashes tests. 2025-07-02 10:51:40 +00:00
gvn-nonsensical-coroutine-layout.stderr Move crashes tests. 2025-07-02 10:51:40 +00:00
gvn-nonsensical-sized-str.rs Move crashes tests. 2025-07-02 10:51:40 +00:00
gvn-nonsensical-sized-str.stderr Move crashes tests. 2025-07-02 10:51:40 +00:00
ice-mir-const-qualif-125837.rs Add test 2024-07-21 21:42:10 +08:00
ice-mir-const-qualif-125837.stderr Add test 2024-07-21 21:42:10 +08:00
important-higher-ranked-regions.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
inline-causes-trimmed-paths.rs Do not trim paths in MIR validator 2025-03-27 17:45:02 +00:00
inline-wrong-abi.rs Remove polymorphization 2024-12-06 16:42:09 -05:00
inline-wrong-abi.stderr Check that the ABI of the instance we are inlining is correct 2024-02-11 19:17:42 +00:00
issue-29227.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-46845.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-60390.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-66851.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-66930.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-67639-normalization-ice.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-67710-inline-projection.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-67947.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-67947.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-68841.rs Stabilize async closures 2024-12-13 00:04:56 +00:00
issue-71793-inline-args-storage.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-73914.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-74739.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-75053.rs Remove attribute #[rustc_error] 2025-03-30 01:32:21 +03:00
issue-75419-validation-impl-trait.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-76248.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-76375.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-76740-copy-propagation.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-76803-branches-not-same.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-77002.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-77359-simplify-arm-identity.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-77911.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-78496.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-80949.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-83499-input-output-iteration-ice.rs c_variadic: Add future-incompatibility warning for ... arguments without a pattern outside of extern blocks 2025-11-10 14:33:56 +01:00
issue-83499-input-output-iteration-ice.stderr c_variadic: Add future-incompatibility warning for ... arguments without a pattern outside of extern blocks 2025-11-10 14:33:56 +01:00
issue-89485.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-91745.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-92893.rs Move let expression checking to parsing 2023-09-11 15:51:18 +00:00
issue-92893.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-99852.rs Remove let_chains feature gate from even more tests 2025-04-18 15:57:29 +02:00
issue-99866.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-101844.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-102389.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-102389.stderr Mention when type parameter could be Clone 2024-04-24 22:21:15 +00:00
issue-105809.rs replace //@ compile-flags: --edition with //@ edition 2025-04-10 09:56:37 +02:00
issue-106062.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-106062.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
issue-107678-projection-with-lifetime.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-107691.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-109004-drop-large-array.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-109743.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-112269.rs Show note for type ascription interpreted as a constant pattern, not a new variable 2023-06-04 20:49:30 +08:00
issue-112269.stderr Trim suggestion parts to the subset that is purely additive 2025-02-14 00:44:10 -08:00
issue-121103.rs Reword "crate not found" resolve message 2025-01-24 01:19:50 +00:00
issue-121103.stderr Reword "crate not found" resolve message 2025-01-24 01:19:50 +00:00
issue66339.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
meaningless-bound.rs Also bail out if predicates contain errors. 2025-07-20 23:15:24 +00:00
meaningless-bound.stderr Also bail out if predicates contain errors. 2025-07-20 23:15:24 +00:00
mir-build-2021-closure-capture-ice-110453-1.rs add tests for ICE in mir building with captured value of unresolved type, None in compiler/rustc_mir_build/src/build/expr/as_place.rs #110453 2024-03-24 10:51:23 +01:00
mir-build-2021-closure-capture-ice-110453-1.stderr add tests for ICE in mir building with captured value of unresolved type, None in compiler/rustc_mir_build/src/build/expr/as_place.rs #110453 2024-03-24 10:51:23 +01:00
mir-build-2021-closure-capture-ice-110453-2.rs add tests for ICE in mir building with captured value of unresolved type, None in compiler/rustc_mir_build/src/build/expr/as_place.rs #110453 2024-03-24 10:51:23 +01:00
mir-build-2021-closure-capture-ice-110453-2.stderr add tests for ICE in mir building with captured value of unresolved type, None in compiler/rustc_mir_build/src/build/expr/as_place.rs #110453 2024-03-24 10:51:23 +01:00
mir-cfg-unpretty-no-panic-81918.rs Add test batch 5 2025-10-12 00:33:20 -04:00
mir-typeck-normalize-fn-sig.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_adt_construction.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_ascription_coercion.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_assign_eval_order.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_augmented_assignments.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_autoderef.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_build_match_comparisons.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_call_with_associated_type.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_calls_to_shims.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_cast_fn_ret.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_codegen_array.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_codegen_array_2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_codegen_call_converging.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_codegen_calls.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_codegen_calls_converging_drops.rs tests: use needs-subprocess instead of ignore-{wasm32,emscripten,sgx} 2025-01-23 20:51:29 +08:00
mir_codegen_calls_converging_drops_2.rs tests: use needs-subprocess instead of ignore-{wasm32,emscripten,sgx} 2025-01-23 20:51:29 +08:00
mir_codegen_calls_diverging.rs tests: use needs-subprocess instead of ignore-{wasm32,emscripten,sgx} 2025-01-23 20:51:29 +08:00
mir_codegen_calls_diverging_drops.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_codegen_critical_edge.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_codegen_spike1.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_codegen_ssa.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
mir_codegen_switch.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_codegen_switchint.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_coercion_casts.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_coercions.rs Allow function_casts_as_integer in non-related ui tests 2025-11-10 16:38:28 +01:00
mir_const_prop_identity.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_const_prop_tuple_field_reorder.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_constval_adts.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_detects_invalid_ops.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_detects_invalid_ops.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
mir_drop_order.rs Add ignore-backends annotations in failing GCC backend ui tests 2025-07-23 13:48:04 +02:00
mir_drop_panics.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_dynamic_drops_1.rs tests: use needs-subprocess instead of ignore-{wasm32,emscripten,sgx} 2025-01-23 20:51:29 +08:00
mir_dynamic_drops_2.rs tests: use needs-subprocess instead of ignore-{wasm32,emscripten,sgx} 2025-01-23 20:51:29 +08:00
mir_dynamic_drops_3.rs tests: use needs-subprocess instead of ignore-{wasm32,emscripten,sgx} 2025-01-23 20:51:29 +08:00
mir_early_return_scope.rs Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
mir_fat_ptr.rs Replace elided_named_lifetimes with mismatched_lifetime_syntaxes 2025-06-04 10:40:04 -04:00
mir_fat_ptr_drop.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_heavy_promoted.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_indexing_oob_1.rs tests: use needs-subprocess instead of ignore-{wasm32,emscripten,sgx} 2025-01-23 20:51:29 +08:00
mir_indexing_oob_2.rs tests: use needs-subprocess instead of ignore-{wasm32,emscripten,sgx} 2025-01-23 20:51:29 +08:00
mir_indexing_oob_3.rs tests: use needs-subprocess instead of ignore-{wasm32,emscripten,sgx} 2025-01-23 20:51:29 +08:00
mir_let_chains_drop_order.rs Add ignore-backends annotations in failing GCC backend ui tests 2025-07-23 13:48:04 +02:00
mir_match_arm_guard.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_match_guard_let_chains_drop_order.rs Add ignore-backends annotations in failing GCC backend ui tests 2025-07-23 13:48:04 +02:00
mir_match_test.rs Stabilize exclusive_range 2024-05-02 19:42:31 -04:00
mir_misc_casts.rs Allow function_casts_as_integer in non-related ui tests 2025-11-10 16:38:28 +01:00
mir_overflow_off.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_query_cycle.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_raw_fat_ptr.rs stabilize raw_ref_op 2024-08-18 19:46:53 +02:00
mir_raw_fat_ptr.stderr bless tests with new lint messages 2025-08-19 21:27:10 +02:00
mir_refs_correct.rs Allow function_casts_as_integer in non-related ui tests 2025-11-10 16:38:28 +01:00
mir_small_agg_arg.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_static_subtype.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_struct_with_assoc_ty.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_temp_promotions.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_void_return.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mir_void_return_2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
remove-zsts-query-cycle.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
simplify-branch-same.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
sized-slice-predicate-116721.rs Move crash test. 2024-06-29 10:42:31 +00:00
ssa-analysis-regression-50041.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
ssa_call_ret.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
static-by-value-dyn.rs Do not assert layout in KnownPanicsLint. 2025-07-25 02:27:30 +00:00
static-by-value-dyn.stderr Do not assert layout in KnownPanicsLint. 2025-07-25 02:27:30 +00:00
static-by-value-slice.rs Check statics' type in type_of. 2025-07-25 23:39:26 +00:00
static-by-value-slice.stderr Check statics' type in type_of. 2025-07-25 23:39:26 +00:00
static-by-value-str.rs Check statics' type in type_of. 2025-07-25 23:39:26 +00:00
static-by-value-str.stderr Check statics' type in type_of. 2025-07-25 23:39:26 +00:00
static_fnptr.rs Document test. 2024-05-04 19:26:51 +00:00
thir-constparam-temp.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
thir-constparam-temp.stderr Implement custom diagnostic for ConstParamTy 2023-06-01 18:21:42 +00:00
unreachable-loop-jump-threading.rs Only traverse reachable blocks in JumpThreading. 2025-06-15 21:12:17 +00:00
unreachable-loop-jump-threading.stderr Only traverse reachable blocks in JumpThreading. 2025-06-15 21:12:17 +00:00
unsize-trait.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
unsized-extern-static.rs Check static is sized when building MIR. 2025-07-25 02:31:59 +00:00
unsized-extern-static.stderr Apply requested changes 2025-09-08 19:19:59 +02:00
var_debug_ref.rs Collect items referenced from var_debug_info 2025-03-26 11:35:34 +01:00