rust/library/alloc
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
..
benches Fix testing of the standard library with Emscripten 2025-01-24 09:25:34 +00:00
src Rollup merge of #136099 - Kijewski:pr-rc-str-default, r=ibraheemdev 2025-02-08 21:37:24 +01:00
tests Remove some unnecessary parens in assert! conditions 2025-02-06 22:28:44 +00:00
Cargo.toml Update compiler-builtins to 0.1.145 2025-02-04 11:49:01 +00:00