Skip to content

Commit a9104e7

Browse files
committed
Mention custom allocators in future possibilities
1 parent cd05ef2 commit a9104e7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

text/3621-derive-smart-pointer.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -723,9 +723,12 @@ proposals for relaxing them have been seen before (e.g., in the
723723
[pre-RFC][pre-rfc].)
724724

725725
One example of a restriction that we could lift is the restriction that there is
726-
only one non-zero-sized field. This could allow implementations of `Rc` and
727-
`Arc` that store the value and refcount in two different allocations, like how
728-
the C++ `shared_ptr` works.
726+
only one non-zero-sized field. This would allow smart pointers to use custom
727+
allocators. (Today, types like `Box` and `Rc` only work with trait objects when
728+
using the default zero-sized allocator.)
729+
730+
This could also allow implementations of `Rc` and `Arc` that store the value and
731+
refcount in two different allocations, like how the C++ `shared_ptr` works.
729732
```rust
730733
#[derive(SmartPointer)]
731734
pub struct Rc<T: ?Sized> {

0 commit comments

Comments
 (0)