rust/library/alloc/src
Matthias Krüger 785a4eb2d2
Rollup merge of #136099 - Kijewski:pr-rc-str-default, r=ibraheemdev
Optimize `Rc::<str>::default()` implementation

This PR lets `impl Default for Rc<str>` re-use the implementation for `Rc::<[u8]>::default()`. The previous version only calculted the memory layout at runtime, even though it should be known at compile time, resulting in an additional function call.

The same optimization is done for `Rc<CStr>`.

Generated byte code: <https://godbolt.org/z/dfq73jsoP>.

Resolves <https://github.com/rust-lang/rust/issues/135784>.

Cc `@Billy-Sheppard.`
2025-02-08 21:37:24 +01:00
..
boxed replace placeholder version 2024-11-27 12:10:21 +00:00
collections Rollup merge of #136215 - btj:patch-1, r=cuviper 2025-01-30 14:25:05 +11:00
ffi Optimize Rc::<str>::default() implementation 2025-01-26 19:12:54 +01:00
raw_vec Polymorphize RawVec 2024-08-09 20:06:26 -04:00
rc Use c"lit" for CStrings without unwrap 2024-12-02 18:16:36 +00:00
testing alloc: add #![warn(unreachable_pub)] 2025-01-20 18:50:56 +01:00
vec [Clippy] Add vec_reserve & vecdeque_reserve diagnostic items 2025-01-25 23:18:18 +01:00
alloc.rs turn rustc_box into an intrinsic 2025-01-03 12:01:31 +01:00
borrow.rs remove const_cow_is_borrowed feature gate 2024-10-12 19:48:28 +02:00
boxed.rs add missing allocator safety in alloc crate 2025-01-21 16:25:56 +08:00
bstr.rs Add doc aliases for BStr and BString 2025-01-22 09:19:24 +02:00
fmt.rs Added struct fmt::FormattingOptions 2024-12-05 21:48:01 +01:00
lib.miri.rs add 'x.py miri', and make it work for 'library/{core,alloc,std}' 2024-04-03 20:27:20 +02:00
lib.rs Rollup merge of #135367 - Urgau:unreach_pub-std-3, r=Noratrieb 2025-01-28 14:23:21 +01:00
macros.rs Update the explanation for why we use box_new in vec! 2025-01-12 13:17:16 -05:00
raw_vec.rs alloc: add #![warn(unreachable_pub)] 2025-01-20 18:50:56 +01:00
rc.rs Optimize Rc::<str>::default() implementation 2025-01-26 19:12:54 +01:00
slice.rs alloc: add #![warn(unreachable_pub)] 2025-01-20 18:50:56 +01:00
str.rs Inline str::repeat 2024-11-06 18:54:50 +00:00
string.rs Update encode_utf16 to mention it is native endian 2025-01-31 11:44:11 +01:00
sync.rs add missing allocator safety in alloc crate 2025-01-21 16:25:56 +08:00
task.rs Stabilize noop_waker 2024-12-05 14:14:17 -08:00