Skip to content

Add extra types to VaArgSafe - #162858

Open
clarfonthey wants to merge 1 commit into
rust-lang:mainfrom
clarfonthey:va-arg-refs
Open

clarfonthey wants to merge 1 commit into
rust-lang:mainfrom
clarfonthey:va-arg-refs

Conversation

@clarfonthey

@clarfonthey clarfonthey commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

Option 3 as proposed by @RalfJung here: #162478 (comment)

This adds the following types to VaArgSafe:

  • Reference equivalents to the same pointers (it's still unsafe to get next_arg)
  • NonNull<T> (for similar reasons)
  • Option<NonNull<T>> (since it's ABI-compatible)
  • NonZero<T> (since it's ABI-compatible)
  • Option<NonZero<T>> (since it's ABI-compatible)

Additionally, as part of implementing this in the compiler, NonZero is promoted from a diagnostic item to a lang item. I'm under the impression this is fine since we're already doing a lang FCP (and none of the lang folks have chimed in yet) but it's worth mentioning.

Also have a Zulip thread for the compiler impl: #t-compiler/help > `VaArgSafe` change + random `Ty` questions @ 💬

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 16, 2026
@clarfonthey clarfonthey added the T-lang Relevant to the language team label Sep 16, 2026
@clarfonthey

Copy link
Copy Markdown
Contributor Author

@rfcbot merge libs,lang

@rust-rfcbot

rust-rfcbot commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

@clarfonthey has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
cc @rust-lang/libs-ping: FCP proposed for libs, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Sep 16, 2026
@clarfonthey
clarfonthey marked this pull request as ready for review September 16, 2026 17:15
@rust-rfcbot rust-rfcbot added the disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. label Sep 16, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 16, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 16, 2026
@rustbot

rustbot commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

r? @Darksonn

rustbot has assigned @Darksonn.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 12 candidates
  • Random selection from Darksonn, JohnTitor, Mark-Simulacrum, aapoalas, jhpratt

@clarfonthey clarfonthey changed the title Add thin references and pointers to VaArgSafe Add extra types to VaArgSafe Sep 16, 2026
@nia-e

nia-e commented Sep 16, 2026

Copy link
Copy Markdown
Member

The docs for VaArgSafe::next_arg currently say

Currently, all types implementing VaArgSafe also implement Copy, but this may change in the future.

this should also be adjusted, but otherwise yeah this makes sense.

@rfcbot reviewed

@clarfonthey
clarfonthey force-pushed the va-arg-refs branch 2 times, most recently from b020d39 to f84f398 Compare September 16, 2026 17:24
@clarfonthey

Copy link
Copy Markdown
Contributor Author

Updated docs to remove note on everything being Copy, also added NonZero and NonNull per discussion in lang meeting.

@clarfonthey clarfonthey added the I-lang-nominated Nominated for discussion during a lang team meeting. label Sep 16, 2026
@traviscross traviscross added P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang I-lang-radar Items that are on lang's radar and will need eventual work or consideration. labels Sep 16, 2026
@steffahn

Copy link
Copy Markdown
Member

The safety comments of next_arg would also need to be updated to cover all the new types.

@folkertdev folkertdev Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add tests for these in tests/ui/c-variadic/roundtrip.rs?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result is very cursed but hopefully still achieves the desired result. Would appreciate an explicit review on those.

@rust-log-analyzer

This comment has been minimized.

Comment thread library/core/src/ffi/va_list.rs Outdated
Comment on lines +420 to +436
#[stable(feature = "c_variadic_nonzero", since = "CURRENT_RUSTC_VERSION")]
unsafe impl<T: ZeroablePrimitive + VaArgSafe> VaArgSafe for NonZero<T> {}
#[stable(feature = "c_variadic_nonzero", since = "CURRENT_RUSTC_VERSION")]
unsafe impl<T: ZeroablePrimitive + VaArgSafe> VaArgSafe for Option<NonZero<T>> {}

#[stable(feature = "c_variadic_nonnull", since = "1.99.0")]
unsafe impl<T> VaArgSafe for NonNull<T> {}
#[stable(feature = "c_variadic_nonnull", since = "1.99.0")]
unsafe impl<T> VaArgSafe for Option<NonNull<T>> {}
#[stable(feature = "c_variadic", since = "1.99.0")]
unsafe impl<T> VaArgSafe for *mut T {}
#[stable(feature = "c_variadic", since = "1.99.0")]
unsafe impl<T> VaArgSafe for *const T {}
#[stable(feature = "c_variadic_refs", since = "CURRENT_RUSTC_VERSION")]
unsafe impl<T> VaArgSafe for &mut T {}
#[stable(feature = "c_variadic_refs", since = "CURRENT_RUSTC_VERSION")]
unsafe impl<T> VaArgSafe for &T {}

@RalfJung RalfJung Sep 16, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the intent is that e.g. NonNull<T> is compatible with *mut T. That will need adjustments in the docs and corresponding adjustments in the const-eval / Miri checking logic.

View changes since the review

@clarfonthey clarfonthey Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that we already had this guarantee, but if we don't, I would rather not overcomplicate this PR and can remove it. (Note: this only needs to hold for sized pointees.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust guarantees they have the same layout, so it's just the docs of next_arg that should document that this equivalence applies here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same layout != same ABI.
But we also guarantee that they have the same ABI.

This applies to most of your additions, e.g. NonZero<i32> vs i32.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, looking at the docs:

Unlike *mut T, the pointer must always be non-null, even if the pointer is never dereferenced. This is so that enums may use this forbidden value as a discriminant – Option<NonNull> has the same size as *mut T. However the pointer may still dangle if it isn’t dereferenced.

That feels pretty much like an explicit guarantee that *mut T, NonNull<T>, and Option<NonNull<T>> are layout-compatible, but I guess we should probably make it more explicit in the reference.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding, variadic arguments simply require layout compatibility, since for example i32 and u32 are interchangeable in them.

If only :)

The comment on next_arg goes into detail on what it means for types to be compatible. It is much more subtle than layout compatibility. E.g. i32 and u32 are only compatible if the runtime value is representable in both types. (so like 3 is compatible but -3 is not.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes, that is cursed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Morally the same is true for the nonzero types and references (which cannot be NULL), but those requirements are already captured by the type itself in these new cases.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs very explicitly say

The actual type of the argument U is compatible with T (as defined below).

So without changing the docs, if the caller uses NonZeroI32 and the callee uses next_arg::<i32>(), we very clearly have UB. (NonZeroI32 is not an "integer type". That term refers to primitive types, iN and uN.)

@clarfonthey clarfonthey Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I did explicitly go through and update the docs for those cases: the general rule for those is that if not all bit patterns are valid, you are guaranteeing that you have passed a valid bit pattern, at risk of UB.

@clarfonthey
clarfonthey force-pushed the va-arg-refs branch 2 times, most recently from 2d31c99 to ba1acb2 Compare September 16, 2026 17:55
@rust-log-analyzer

This comment has been minimized.

/// - [`c_int`], [`c_long`] and [`c_longlong`]
/// - [`c_uint`], [`c_ulong`] and [`c_ulonglong`]
/// - [`c_double`]
/// - `*const T` and `*mut T`

@Mark-Simulacrum Mark-Simulacrum Sep 20, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably expand this with the new types we guarantee impls for.

View changes since the review

@Darksonn Darksonn Sep 21, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests for the cases with breakage shared in #162858 (comment) and #162858 (comment).

View changes since the review

@clarfonthey clarfonthey removed the I-libs-nominated Nominated for discussion during a libs team meeting. label Sep 22, 2026
@traviscross

traviscross commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Thanks @clarfonthey.

@rfcbot reviewed

And thanks to @theemathas for catching that this would be breaking if VaArgSafe stabilized with Rust 1.99 so we could destabilize it to give us time in #162909.

@tmandry

tmandry commented Sep 23, 2026

Copy link
Copy Markdown
Member

@rfcbot reviewed

+1, thanks @theemathas for the catch and @maxdexh for buying us time with #162909!

@rust-rfcbot rust-rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Sep 30, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@traviscross traviscross removed I-lang-nominated Nominated for discussion during a lang team meeting. P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang labels Sep 30, 2026
@clarfonthey

Copy link
Copy Markdown
Contributor Author

Took a bit to get back to it, but I've also managed to replicate the test failures on aarch64 locally via qemu, so, I will try and get those fixed up before the FCP is over.

@rustbot

rustbot commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Comment thread tests/ui/c-variadic/roundtrip.rs Outdated
// Intersperse a small type to test alignment logic. A `u32` (i.e. `c_uint`) is the smallest
// type that implements `VaArgSafe` (except on some 16-bit targets): smaller types would
// automatically be promoted.
assert_eq!(ap.next_arg::<u32>(), 0xAAAA_AAAAu32);

@clarfonthey clarfonthey Oct 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is returning 0xFFFF_FFFFu32 instead of 0xAAAA_AAAAu32 and I genuinely have no idea. This isn't even the hard part of the code, and it works in const context, just not at runtime, so, definitely some ABI shenanigans.

View changes since the review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For which input type?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Zulip: #t-compiler/help > `VaArgSafe` change + random `Ty` questions @ 💬

This is definitely the -1 for NonZero<i32>, but, the previous argument was supposed to be that type, and it's 0, which is definitely not right.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On x86_64 I hit this assert

assert!(layout.ty.is_integral());

Because of std::option::Option<std::num::NonZero<i128>>. It's fine to remove that assert really. But, there might be similar asserts on targets that we don't run CI for, so this'll need some validation.

With that assert removed the roundtrip test passes.

I assume you're running on aarch64 where I get that same error, still looking into it

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rust-rfcbot rust-rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Oct 10, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-aarch64-gnu-llvm-22-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- [ui] tests/ui/c-variadic/roundtrip.rs stdout ----

error: test did not exit with success! code=None so test would pass with `run-crash`
status: signal: 6 (SIGABRT) (core dumped)
command: cd "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/c-variadic/roundtrip" && RUSTC="/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" RUST_TEST_THREADS="4" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/c-variadic/roundtrip/a"
stdout: none
--- stderr -------------------------------

thread 'main' (39801) panicked at /checkout/tests/ui/c-variadic/roundtrip.rs:48:5:
assertion `left == right` failed: -432476160 4294967295 0
---
panic in a function that cannot unwind
stack backtrace:
   0:     0xff8a5fa0fdf4 - <<std[e255f19bdb4cfb7]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[334adfad61266349]::fmt::Display>::fmt
   1:     0xff8a5fa610dc - core[334adfad61266349]::fmt::write
   2:     0xff8a5fa254bc - <std[e255f19bdb4cfb7]::sys::stdio::unix::Stderr as core[334adfad61266349]::io::write::Write>::write_fmt
   3:     0xff8a5f9d4a58 - std[e255f19bdb4cfb7]::panicking::default_hook::{closure#0}
   4:     0xff8a5f9fedf8 - std[e255f19bdb4cfb7]::panicking::default_hook
   5:     0xff8a5f9ff278 - std[e255f19bdb4cfb7]::panicking::panic_with_hook
   6:     0xff8a5f9d4b50 - std[e255f19bdb4cfb7]::panicking::panic_handler::{closure#0}
   7:     0xff8a5f9c5364 - std[e255f19bdb4cfb7]::sys::backtrace::__rust_end_short_backtrace::<std[e255f19bdb4cfb7]::panicking::panic_handler::{closure#0}, !>
   8:     0xff8a5f9d691c - __rustc[9ccf4299e9c9c915]::rust_begin_unwind
   9:     0xff8a5f9b9244 - core[334adfad61266349]::panicking::panic_nounwind_fmt
  10:     0xff8a5f9b915c - core[334adfad61266349]::panicking::panic_nounwind
  11:     0xff8a5f9b9324 - core[334adfad61266349]::panicking::panic_cannot_unwind
  12:     0xaab4130439c4 - roundtrip[2ae0f7d716a9c1b5]::non_const_variadic::<core[334adfad61266349]::num::nonzero::NonZero<i32>>
  13:     0xaab413045304 - roundtrip[2ae0f7d716a9c1b5]::main
  14:     0xaab413045270 - std[e255f19bdb4cfb7]::sys::backtrace::__rust_begin_short_backtrace::<fn(), ()>
  15:     0xaab413045288 - std[e255f19bdb4cfb7]::rt::lang_start::<()>::{closure#0}
  16:     0xff8a5f9fd4f4 - std[e255f19bdb4cfb7]::rt::lang_start_internal
  17:     0xaab4130479ec - main
  18:     0xff8a5f7b2f1c - <unknown>
  19:     0xff8a5f7b305c - __libc_start_main
  20:     0xaab413042530 - _start
  21:                0x0 - <unknown>
thread caused non-unwinding panic. aborting.
---

1046    |
1047    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1048 
- error[E0080]: constructing invalid value of type [u8; 24]: at [8], encountered a pointer, but expected an integer
+ error[E0080]: constructing invalid value of type [u8; 32]: at [0], encountered a pointer, but expected an integer
1050   --> $DIR/c-variadic-fail.rs:202:22
1051    |
1052 LL | fn use_after_free() {


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args consts/const-eval/c-variadic-fail.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/consts/const-eval/c-variadic-fail.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/consts/const-eval/c-variadic-fail" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015" "-Zextra-const-ub-checks"
stdout: none
--- stderr -------------------------------
error[E0080]: more C-variadic arguments read than were passed
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:30:13
   |
LL | unsafe fn read_too_many() {
...
LL |     const { read_n::<1>() }
   |             ^^^^^^^^^^^^^ evaluation of `read_too_many::{constant#2}` failed inside this call
   |
note: inside `read_n::<1>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:18:17
   |
LL |         let _ = ap.next_arg::<i32>();
   |                 ^^^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<i32>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:30:5
   |
LL |     const { read_n::<1>() }
   |     ^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:30:5
   |
LL |     const { read_n::<1>() }
   |     ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: more C-variadic arguments read than were passed
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:34:13
   |
LL | unsafe fn read_too_many() {
...
LL |     const { read_n::<2>(1) }
   |             ^^^^^^^^^^^^^^ evaluation of `read_too_many::{constant#3}` failed inside this call
   |
note: inside `read_n::<2>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:18:17
   |
LL |         let _ = ap.next_arg::<i32>();
   |                 ^^^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<i32>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:34:5
   |
LL |     const { read_n::<2>(1) }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:34:5
   |
LL |     const { read_n::<2>(1) }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: va_arg value mismatch: value `-1_i32` cannot be represented by type `u32`
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:74:13
   |
LL | unsafe fn read_cast_numeric() {
...
LL |     const { read_as::<u32>(-1i32) };
   |             ^^^^^^^^^^^^^^^^^^^^^ evaluation of `read_cast_numeric::{constant#12}` failed inside this call
   |
note: inside `read_as::<u32>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:39:5
   |
LL |     ap.next_arg::<T>()
   |     ^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<u32>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:74:5
   |
LL |     const { read_as::<u32>(-1i32) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:74:5
   |
LL |     const { read_as::<u32>(-1i32) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: va_arg value mismatch: value `-2147483648_i32` cannot be represented by type `u32`
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:76:13
   |
LL | unsafe fn read_cast_numeric() {
...
LL |     const { read_as::<u32>(i32::MIN) };
   |             ^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `read_cast_numeric::{constant#13}` failed inside this call
   |
note: inside `read_as::<u32>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:39:5
   |
LL |     ap.next_arg::<T>()
   |     ^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<u32>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:76:5
   |
LL |     const { read_as::<u32>(i32::MIN) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:76:5
   |
LL |     const { read_as::<u32>(i32::MIN) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: va_arg value mismatch: value `4294967295_u32` cannot be represented by type `i32`
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:78:13
   |
LL | unsafe fn read_cast_numeric() {
...
LL |     const { read_as::<i32>(u32::MAX) };
   |             ^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `read_cast_numeric::{constant#14}` failed inside this call
   |
note: inside `read_as::<i32>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:39:5
   |
LL |     ap.next_arg::<T>()
   |     ^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<i32>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:78:5
   |
LL |     const { read_as::<i32>(u32::MAX) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:78:5
   |
LL |     const { read_as::<i32>(u32::MAX) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: va_arg value mismatch: value `2147483648_u32` cannot be represented by type `i32`
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:80:13
   |
LL | unsafe fn read_cast_numeric() {
...
LL |     const { read_as::<i32>(i32::MAX as u32 + 1) };
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `read_cast_numeric::{constant#15}` failed inside this call
   |
note: inside `read_as::<i32>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:39:5
   |
LL |     ap.next_arg::<T>()
   |     ^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<i32>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:80:5
   |
LL |     const { read_as::<i32>(i32::MAX as u32 + 1) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:80:5
   |
LL |     const { read_as::<i32>(i32::MAX as u32 + 1) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: va_arg value mismatch: value `18446744073709551615_u64` cannot be represented by type `i64`
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:82:13
   |
LL | unsafe fn read_cast_numeric() {
...
LL |     const { read_as::<i64>(u64::MAX) };
   |             ^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `read_cast_numeric::{constant#16}` failed inside this call
   |
note: inside `read_as::<i64>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:39:5
   |
LL |     ap.next_arg::<T>()
   |     ^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<i64>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:82:5
   |
LL |     const { read_as::<i64>(u64::MAX) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:82:5
   |
LL |     const { read_as::<i64>(u64::MAX) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: va_arg value mismatch: value `9223372036854775808_u64` cannot be represented by type `i64`
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:84:13
   |
LL | unsafe fn read_cast_numeric() {
...
LL |     const { read_as::<i64>(i64::MAX as u64 + 1) };
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `read_cast_numeric::{constant#17}` failed inside this call
   |
note: inside `read_as::<i64>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:39:5
   |
LL |     ap.next_arg::<T>()
   |     ^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<i64>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:84:5
   |
LL |     const { read_as::<i64>(i64::MAX as u64 + 1) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:84:5
   |
LL |     const { read_as::<i64>(i64::MAX as u64 + 1) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: va_arg type mismatch: requested `i32` is incompatible with next argument of type `u64`
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:87:13
   |
LL | unsafe fn read_cast_numeric() {
...
LL |     const { read_as::<i32>(1u64) };
   |             ^^^^^^^^^^^^^^^^^^^^ evaluation of `read_cast_numeric::{constant#18}` failed inside this call
   |
note: inside `read_as::<i32>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:39:5
   |
LL |     ap.next_arg::<T>()
   |     ^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<i32>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:87:5
   |
LL |     const { read_as::<i32>(1u64) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:87:5
   |
LL |     const { read_as::<i32>(1u64) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: va_arg type mismatch: requested `f64` is incompatible with next argument of type `i32`
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:90:13
   |
LL | unsafe fn read_cast_numeric() {
...
LL |     const { read_as::<f64>(1i32) };
   |             ^^^^^^^^^^^^^^^^^^^^ evaluation of `read_cast_numeric::{constant#19}` failed inside this call
   |
note: inside `read_as::<f64>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:39:5
   |
LL |     ap.next_arg::<T>()
   |     ^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<f64>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:90:5
   |
LL |     const { read_as::<f64>(1i32) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:90:5
   |
LL |     const { read_as::<f64>(1i32) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: va_arg type mismatch: requested `*const u16` is incompatible with next argument of type `*const c_void`
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:113:13
   |
LL | unsafe fn read_cast_pointer() {
...
LL |     const { read_as::<*const u16>(ptr::dangling::<c_void>()) };
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `read_cast_pointer::{constant#12}` failed inside this call
   |
note: inside `read_as::<*const u16>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:39:5
   |
LL |     ap.next_arg::<T>()
   |     ^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<*const u16>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:113:5
   |
LL |     const { read_as::<*const u16>(ptr::dangling::<c_void>()) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:113:5
   |
LL |     const { read_as::<*const u16>(ptr::dangling::<c_void>()) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: va_arg type mismatch: requested `*const c_void` is incompatible with next argument of type `*const u16`
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:115:13
   |
LL | unsafe fn read_cast_pointer() {
...
LL |     const { read_as::<*const c_void>(ptr::dangling::<u16>()) };
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `read_cast_pointer::{constant#13}` failed inside this call
   |
note: inside `read_as::<*const c_void>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:39:5
   |
LL |     ap.next_arg::<T>()
   |     ^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<*const c_void>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:115:5
   |
LL |     const { read_as::<*const c_void>(ptr::dangling::<u16>()) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:115:5
   |
LL |     const { read_as::<*const c_void>(ptr::dangling::<u16>()) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: va_arg type mismatch: requested `*const u16` is incompatible with next argument of type `*const i32`
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:117:13
   |
LL | unsafe fn read_cast_pointer() {
...
LL |     const { read_as::<*const u16>(ptr::dangling::<i32>()) };
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `read_cast_pointer::{constant#14}` failed inside this call
   |
note: inside `read_as::<*const u16>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:39:5
   |
LL |     ap.next_arg::<T>()
   |     ^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<*const u16>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:117:5
   |
LL |     const { read_as::<*const u16>(ptr::dangling::<i32>()) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:117:5
   |
LL |     const { read_as::<*const u16>(ptr::dangling::<i32>()) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: va_arg type mismatch: requested `*const u8` is incompatible with next argument of type `usize`
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:120:13
   |
LL | unsafe fn read_cast_pointer() {
...
LL |     const { read_as::<*const u8>(1usize) };
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `read_cast_pointer::{constant#15}` failed inside this call
   |
note: inside `read_as::<*const u8>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:39:5
   |
LL |     ap.next_arg::<T>()
   |     ^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<*const u8>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:120:5
   |
LL |     const { read_as::<*const u8>(1usize) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:120:5
   |
LL |     const { read_as::<*const u8>(1usize) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: constructing invalid value of type NonNull<c_void>: at .pointer, encountered 0, but expected something greater or equal to 1
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:125:13
   |
LL | unsafe fn read_cast_null() {
LL |     const { read_as::<NonNull<c_void>>(ptr::null::<c_void>()) };
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `read_cast_null::{constant#0}` failed inside this call
   |
note: inside `read_as::<NonNull<c_void>>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:39:5
   |
LL |     ap.next_arg::<T>()
   |     ^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<NonNull<c_void>>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:125:5
   |
LL |     const { read_as::<NonNull<c_void>>(ptr::null::<c_void>()) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:125:5
   |
LL |     const { read_as::<NonNull<c_void>>(ptr::null::<c_void>()) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: constructing invalid value of type NonNull<c_void>: at .pointer, encountered 0, but expected something greater or equal to 1
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:127:13
   |
LL | unsafe fn read_cast_null() {
...
LL |     const { read_as::<NonNull<c_void>>(ptr::null_mut::<c_void>()) };
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `read_cast_null::{constant#1}` failed inside this call
   |
note: inside `read_as::<NonNull<c_void>>`
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:39:5
   |
LL |     ap.next_arg::<T>()
   |     ^^^^^^^^^^^^^^^^^^
note: inside `VaList::<'_>::next_arg::<NonNull<c_void>>`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:509:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:127:5
   |
LL |     const { read_as::<NonNull<c_void>>(ptr::null_mut::<c_void>()) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:127:5
   |
LL |     const { read_as::<NonNull<c_void>>(ptr::null_mut::<c_void>()) };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: constructing invalid value of type NonNull<c_void>: at .pointer, encountered 0, but expected something greater or equal to 1
---

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:255:5
   |
LL |     const { unsafe { helper(1, 2, 3) } };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:255:5
   |
LL |     const { unsafe { helper(1, 2, 3) } };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0080]: pointer not dereferenceable: pointer must point to some allocation, but got null pointer
##[error]  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:263:5
   |
LL | fn drop_of_invalid() {
LL |     const {
...
LL |     }
   |     ^ evaluation of `drop_of_invalid::{constant#0}` failed inside this call
   |
note: inside `std::ptr::drop_glue::<VaList<'_>> - shim(Some(VaList<'_>))`
  --> /rustc/FAKE_PREFIX/library/core/src/ptr/mod.rs:844:0
note: inside `<VaList<'_> as Drop>::drop`
  --> /rustc/FAKE_PREFIX/library/core/src/ffi/va_list.rs:262:0

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:260:5
   |
LL | /     const {
LL | |         let mut invalid: MaybeUninit<VaList> = MaybeUninit::zeroed();
LL | |         let ap = unsafe { invalid.assume_init() };
LL | |     }
   | |_____^

note: erroneous constant encountered
  --> /checkout/tests/ui/consts/const-eval/c-variadic-fail.rs:260:5
   |
LL | /     const {
LL | |         let mut invalid: MaybeUninit<VaList> = MaybeUninit::zeroed();
LL | |         let ap = unsafe { invalid.assume_init() };
LL | |     }
   | |_____^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

---

---- [ui] tests/ui/consts/const-eval/c-variadic-fail.rs stdout end ----
---- [ui] tests/ui/consts/const-eval/c-variadic.rs stdout ----

error: test did not exit with success! code=None so test would pass with `run-crash`
status: signal: 11 (SIGSEGV) (core dumped)
command: cd "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/consts/const-eval/c-variadic" && RUSTC="/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" RUST_TEST_THREADS="4" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/consts/const-eval/c-variadic/a"
stdout: none
stderr: none

---- [ui] tests/ui/consts/const-eval/c-variadic.rs stdout end ----

@theemathas

Copy link
Copy Markdown
Contributor

I assume that, once this PR is merged, we can re-stabilize VaArgSafe?

@asquared31415

asquared31415 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

I think that, per #162478 (comment) there needs to be some sort of improvement to the details of this trait as a whole. It's "obviously correct" for wrappers around c_int to implement VaArgSafe, but right now they do not have a way to do so. Stabilizing things as-is (even with this PR) means that any future mechanism for permitting a type to implement VaArgSafe becomes a new semver hazard, as implementing it is a breaking change to all consumers of that type. Stabilizing VaArgSafe right now would mean committing to "we will never automatically implement VaArgSafe for any type, and we will never implement VaArgSafe on any types in std that are stable without it".

@theemathas

Copy link
Copy Markdown
Contributor

@asquared31415 The VaArgSafe trait is currently sealed. So, users can only rely on fundamental types and local user-defined types not implementing the trait.

So, by stabilizing VaArgSafe, we're committing to:

  • VaArgSafe being a trait
  • VaArgSafe not being implemented on Pin or Box
  • Not automatically implementing VaArgSafe on user-defined types

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-lang Relevant to the language team T-libs Relevant to the library team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.