From 6537605fa4113098a847434087358dece37e4af3 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Thu, 30 Jul 2026 11:08:20 -0400 Subject: [PATCH] Remove `Copy` supertrait from `VaList` --- library/core/src/ffi/va_list.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/core/src/ffi/va_list.rs b/library/core/src/ffi/va_list.rs index 2bfd69b1b5b02..bcab2c7a6c45f 100644 --- a/library/core/src/ffi/va_list.rs +++ b/library/core/src/ffi/va_list.rs @@ -313,7 +313,7 @@ const impl<'f> Drop for VaList<'f> { // meantime. #[lang = "va_arg_safe"] #[stable(feature = "c_variadic", since = "CURRENT_RUSTC_VERSION")] -pub impl(self) unsafe trait VaArgSafe: Copy {} +pub impl(self) unsafe trait VaArgSafe {} crate::cfg_select! { any(target_arch = "avr", target_arch = "msp430") => { @@ -458,6 +458,10 @@ impl<'f> VaList<'f> { /// - The actual type of the argument `U` is compatible with `T` (as defined below). /// - If `U` and `T` are both integer types, then the value passed by the caller must be /// representable in both types. + /// - If `T` is not [`Copy`], then it must not have already been read using `next_arg` + /// on a [`clone`][VaList::clone]d copy of this `VaList`. + /// (Currently, all types implementing [`VaArgSafe`] also implement [`Copy`], + /// but this may change in the future.) /// /// Types `T` and `U` are compatible when: ///