Commit df2b28f
Optimize
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 <rust-lang#135784>.Rc::<str>::default() implementation1 parent cd5fd52 commit df2b28f
2 files changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
965 | 965 | | |
966 | 966 | | |
967 | 967 | | |
968 | | - | |
969 | | - | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
970 | 971 | | |
971 | 972 | | |
972 | 973 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2369 | 2369 | | |
2370 | 2370 | | |
2371 | 2371 | | |
2372 | | - | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
2373 | 2375 | | |
2374 | 2376 | | |
2375 | 2377 | | |
| |||
0 commit comments