Skip to content

Commit 8ef4a25

Browse files
committed
Auto merge of #141348 - EFanZh:zero-cost-rc-deref, r=<try>
Make `Rc<T>::deref` zero-cost This PR makes `Rc::deref` zero-cost by changing the internal pointer so that it points to the value directly instead of the allocation. This is split out from #132553, which will also make `Arc::deref` zero-cost.
2 parents b5eb989 + f5245ba commit 8ef4a25

File tree

17 files changed

+3116
-1180
lines changed

17 files changed

+3116
-1180
lines changed

library/alloc/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@
204204
#[macro_use]
205205
mod macros;
206206

207+
#[cfg(not(no_rc))]
208+
mod raw_rc;
207209
mod raw_vec;
208210

209211
// Heaps provided for low-level allocation strategies

library/alloc/src/raw_rc/mod.rs

Lines changed: 539 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)