summary refs log tree commit diff
path: root/library/alloc/src/rc
AgeCommit message (Collapse)AuthorLines
2023-12-10remove redundant importssurechen-5/+0
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-06-19Introduce `alloc::::UniqueRc`Eric Holk-0/+45
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-03-12Fix formatting of new Rc::into_inner testDavid Tolnay-1/+0
2023-03-11Introduce `Rc::into_inner`, as a parallel to `Arc::into_inner`Josh Triplett-0/+16
Unlike `Arc`, `Rc` doesn't have the same race condition to avoid, but maintaining an equivalent API still makes it easier to work with both `Rc` and `Arc`.
2022-05-29Use Box::new() instead of box syntax in alloc testsest31-6/+6
2022-03-10Use implicit capture syntax in format_argsT-O-R-U-S-3/+3
This updates the standard library's documentation to use the new syntax. The documentation is worthwhile to update as it should be more idiomatic (particularly for features like this, which are nice for users to get acquainted with). The general codebase is likely more hassle than benefit to update: it'll hurt git blame, and generally updates can be done by folks updating the code if (and when) that makes things more readable with the new format. A few places in the compiler and library code are updated (mostly just due to already having been done when this commit was first authored).
2021-01-06Re-stabilize Weak::as_ptr &friends for unsized TCAD97-0/+41
As per T-lang consensus, this uses a branch to handle the dangling case. The discussed optimization of only doing the branch in the T: ?Sized case is left for a followup patch, as doing so is not trivial (as it requires specialization for correctness, not just optimization).
2020-12-28de-stabilize unsized raw ptr methods for WeakRalf Jung-24/+0
2020-09-12Add tests for weak into/from rawCAD97-0/+42
2020-08-27`impl Rc::new_cyclic`mental32-0/+66
2020-07-27mv std libs to library/mark-0/+436