mirror of https://github.com/rust-lang/rfcs.git
Mention custom allocators in future possibilities
This commit is contained in:
parent
cd05ef26a9
commit
a9104e7814
|
@ -723,9 +723,12 @@ proposals for relaxing them have been seen before (e.g., in the
|
||||||
[pre-RFC][pre-rfc].)
|
[pre-RFC][pre-rfc].)
|
||||||
|
|
||||||
One example of a restriction that we could lift is the restriction that there is
|
One example of a restriction that we could lift is the restriction that there is
|
||||||
only one non-zero-sized field. This could allow implementations of `Rc` and
|
only one non-zero-sized field. This would allow smart pointers to use custom
|
||||||
`Arc` that store the value and refcount in two different allocations, like how
|
allocators. (Today, types like `Box` and `Rc` only work with trait objects when
|
||||||
the C++ `shared_ptr` works.
|
using the default zero-sized allocator.)
|
||||||
|
|
||||||
|
This could also allow implementations of `Rc` and `Arc` that store the value and
|
||||||
|
refcount in two different allocations, like how the C++ `shared_ptr` works.
|
||||||
```rust
|
```rust
|
||||||
#[derive(SmartPointer)]
|
#[derive(SmartPointer)]
|
||||||
pub struct Rc<T: ?Sized> {
|
pub struct Rc<T: ?Sized> {
|
||||||
|
|
Loading…
Reference in New Issue