Skip to content

Commit

Permalink
Auto merge of rust-lang#133061 - scottmcm:dedup-rc, r=<try>
Browse files Browse the repository at this point in the history
[DRAFT] `Rc`: allow deduping both `deref` and `clone` across types

This works by *always* putting the counts *just* before the value, rather than using an `RcInner` type at all.

By doing that, the offset to the counts are exactly the same for all types -- small or large, low alignment or high -- so `Rc::clone` can be polymorphized, and `Rc::deref` is always just a no-op.

r? ghost
  • Loading branch information
bors committed Nov 16, 2024
2 parents 917a50a + 97b8832 commit 711b97b
Show file tree
Hide file tree
Showing 8 changed files with 1,062 additions and 650 deletions.
2 changes: 2 additions & 0 deletions library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,12 @@
#![feature(async_closure)]
#![feature(async_fn_traits)]
#![feature(async_iterator)]
#![feature(box_as_ptr)]
#![feature(box_uninit_write)]
#![feature(clone_to_uninit)]
#![feature(coerce_unsized)]
#![feature(const_align_of_val)]
#![feature(const_alloc_layout)]
#![feature(const_box)]
#![feature(const_eval_select)]
#![feature(const_heap)]
Expand Down
Loading

0 comments on commit 711b97b

Please sign in to comment.