rust/library
Jacob Pratt 43d2006c25
Rollup merge of #150436 - va-list-copy, r=workingjubilee,RalfJung
`c_variadic`: impl `va_copy` and `va_end` as Rust intrinsics

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

Implement `va_copy` as (the rust equivalent of) `memcpy`, which is the behavior of all current LLVM targets. By providing our own implementation, we can guarantee its behavior. These guarantees are important for implementing c-variadics in e.g. const-eval.

Discussed in [#t-compiler/const-eval > c-variadics in const-eval](https://rust-lang.zulipchat.com/#narrow/channel/146212-t-compiler.2Fconst-eval/topic/c-variadics.20in.20const-eval/with/565509704).

I've also updated the comment for `Drop` a bit. The background here is that the C standard requires that `va_end` is used in the same function (and really, in the same scope) as the corresponding `va_start` or `va_copy`. That is because historically `va_start` would start a scope, which `va_end` would then close. e.g.

https://softwarepreservation.computerhistory.org/c_plus_plus/cfront/release_3.0.3/source/incl-master/proto-headers/stdarg.sol

```c
#define         va_start(ap, parmN)     {\
        va_buf  _va;\
        _vastart(ap = (va_list)_va, (char *)&parmN + sizeof parmN)
#define         va_end(ap)      }
#define         va_arg(ap, mode)        *((mode *)_vaarg(ap, sizeof (mode)))
```

The C standard still has to consider such implementations, but for Rust they are irrelevant. Hence we can use `Clone` for `va_copy` and `Drop` for `va_end`.
2026-01-20 19:46:29 -05:00
..
alloc Rollup merge of #148769 - stabilize/alloc_layout_extra, r=scottmcm 2026-01-18 03:16:44 -05:00
alloctests Rollup merge of #148769 - stabilize/alloc_layout_extra, r=scottmcm 2026-01-18 03:16:44 -05:00
backtrace@b65ab935fb Update the backtrace submodule 2025-06-16 07:00:13 +00:00
compiler-builtins compiler-builtins: Enable AArch64 __chkstk for MinGW 2026-01-08 05:01:35 -05:00
core Rollup merge of #150436 - va-list-copy, r=workingjubilee,RalfJung 2026-01-20 19:46:29 -05:00
coretests feat: support pointers in type info 2026-01-19 09:42:55 -06:00
panic_abort Use core via rustc-std-workspace-core in library/panic* 2025-07-31 22:47:24 +00:00
panic_unwind Fix new function_casts_as_integer lint errors in core, std, panic_unwind and compiler crates 2025-11-10 16:38:28 +01:00
portable-simd Remove more #[must_use] from portable-simd 2025-11-11 13:27:04 -08:00
proc_macro Update literal-escaper version to 0.0.7 2026-01-08 14:10:33 +01:00
profiler_builtins Fix profiler_builtins build script to handle full path to profiler lib 2025-04-11 16:57:38 +02:00
rtstartup Update cfg(bootstrap) 2025-07-01 10:55:49 -07:00
rustc-std-workspace-alloc Disable unit tests for stdlib packages that don't contain any 2025-07-24 09:15:28 +00:00
rustc-std-workspace-core Use core via rustc-std-workspace-core in library/panic* 2025-07-31 22:47:24 +00:00
rustc-std-workspace-std Disable unit tests for stdlib packages that don't contain any 2025-07-24 09:15:28 +00:00
std Rollup merge of #151418 - windows-error-kind-size, r=nagisa 2026-01-20 19:50:11 +01:00
std_detect Remove unnecessary module 2026-01-08 15:02:42 +00:00
stdarch Merge pull request #1984 from rust-lang/rustc-pull 2026-01-03 03:33:46 +00:00
sysroot Remove std_detect_file_io and std_detect_dlsym_getauxval features 2026-01-08 14:50:12 +00:00
test rustdoc: Write newline differently 2025-12-13 16:31:09 +09:00
unwind Correct hexagon "unwinder_private_data_size" 2025-12-29 15:21:09 -06:00
windows_targets Rollup merge of #144399 - bjorn3:stdlib_tests_separate_packages, r=Mark-Simulacrum 2025-07-28 08:36:53 +02:00
Cargo.lock Update literal-escaper version to 0.0.7 2026-01-08 14:10:33 +01:00
Cargo.toml Remove the std workspace patch for compiler-builtins 2025-08-19 18:56:35 +00:00