rust/library/alloc/src
Eric Holk 53003cdd86
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.
2023-06-19 12:24:06 -07:00
..
alloc run alloc benchmarks in Miri and fix UB 2022-11-07 10:34:04 +01:00
boxed More IS_ZST in library 2023-04-21 16:29:27 -07:00
collections s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedList 2023-06-14 09:28:54 +02:00
ffi Remove a couple of #[doc(hidden)] pub fn and their #[feature] gates 2023-02-10 08:06:35 +01:00
raw_vec Add a unit test for zero-sized types in RawVec. 2021-11-26 19:30:45 +11:00
rc Introduce alloc::::UniqueRc 2023-06-19 12:24:06 -07:00
slice ignore core, alloc and test tests that require unwinding on panic=abort 2023-06-13 15:53:24 +02:00
sync Add Arc::into_inner for safely discarding Arcs without calling the destructor on the inner type. 2023-01-22 01:43:25 +09:00
testing Share testing utilities with non-btree test cases 2022-05-02 10:07:50 +02:00
vec s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedList 2023-06-14 09:28:54 +02:00
alloc.rs remove box_free and replace with drop impl 2023-06-16 13:41:06 -07:00
borrow.rs enable rust_2018_idioms for doctests 2023-05-07 00:12:29 +03:00
boxed.rs remove box_free and replace with drop impl 2023-06-16 13:41:06 -07:00
fmt.rs enable rust_2018_idioms for doctests 2023-05-07 00:12:29 +03:00
lib.rs reorder attributes to make miri-test-libstd work again 2023-06-11 22:15:46 +02:00
macros.rs Remove or justify use of #[rustc_box] 2023-02-27 20:54:55 -05:00
raw_vec.rs remove some unneeded imports 2023-04-12 19:27:18 +02:00
rc.rs Introduce alloc::::UniqueRc 2023-06-19 12:24:06 -07:00
slice.rs slice: Add a specialization for clone_into when T is Copy 2023-01-28 20:37:01 +01:00
str.rs Spelling library/ 2023-04-26 02:10:22 -04:00
string.rs Rollup merge of #109814 - est31:stabilize_string_leak, r=Amanieu 2023-06-14 18:10:28 +02:00
sync.rs remove box_free and replace with drop impl 2023-06-16 13:41:06 -07:00
task.rs Updating Wake example to use new 'pin!' macro 2023-04-25 13:50:50 +02:00
tests.rs fix an alloc test 2023-03-03 17:47:48 +00:00