diff options
| author | Eric Holk <ericholk@microsoft.com> | 2023-05-19 10:01:49 -0700 |
|---|---|---|
| committer | Eric Holk <ericholk@microsoft.com> | 2023-06-19 12:24:06 -0700 |
| commit | 53003cdd86592f8a9844eef5060699e981dacf07 (patch) | |
| tree | 7ab70be1edb0f40d3ebccb27398c1c8e5c9293e8 /compiler/rustc_codegen_gcc | |
| parent | 689511047a75a30825e367d4fd45c74604d0b15e (diff) | |
| download | rust-53003cdd86592f8a9844eef5060699e981dacf07.tar.gz rust-53003cdd86592f8a9844eef5060699e981dacf07.zip | |
Introduce `alloc::::UniqueRc`
This is an `Rc` that is guaranteed to only have one strong reference. Because it is uniquely owned, it can safely implement `DerefMut`, which allows programs to have an initialization phase where structures inside the `Rc` can be mutated. The `UniqueRc` can then be converted to a regular `Rc`, allowing sharing and but read-only access. During the "initialization phase," weak references can be created, but attempting to upgrade these will fail until the `UniqueRc` has been converted to a regular `Rc`. This feature can be useful to create cyclic data structures. This API is an implementation based on the feedback provided to the ACP at https://github.com/rust-lang/libs-team/issues/90.
Diffstat (limited to 'compiler/rustc_codegen_gcc')
0 files changed, 0 insertions, 0 deletions
