Files
rust/library/alloc/src
Matthias Krüger 8d52aae968 Rollup merge of #136089 - jwong101:box-default-debug-stack-usage, r=Amanieu
Reduce `Box::default` stack copies in debug mode

The `Box::new(T::default())` implementation of `Box::default` only
had two stack copies in debug mode, compared to the current version,
which has four. By avoiding creating any `MaybeUninit<T>`'s and just writing
`T` directly to the `Box` pointer, the stack usage in debug mode remains
the same as the old version.

Another option would be to mark `Box::write` as `#[inline(always)]`,
and change it's implementation to to avoid calling `MaybeUninit::write`
(which creates a `MaybeUninit<T>` on the stack) and to use `ptr::write` instead.

Fixes: #136043
2025-02-21 12:45:22 +01:00
..
2024-11-27 12:10:21 +00:00
2025-02-09 17:11:13 +00:00
2024-08-09 20:06:26 -04:00
2024-12-02 18:16:36 +00:00
2025-02-13 13:10:27 -08:00
2025-02-09 17:11:13 +00:00
2025-01-22 09:19:24 +02:00
2024-12-05 21:48:01 +01:00
2024-11-06 18:54:50 +00:00
2025-02-08 22:12:13 +00:00
2024-12-05 14:14:17 -08:00