about summary refs log tree commit diff
path: root/library/alloc/src/rc/tests.rs
AgeCommit message (Collapse)AuthorLines
2025-03-07Move last remaining Rc test to alloctestsbjorn3-15/+0
2025-03-07Move most Rc tests to alloctestsbjorn3-649/+0
2024-12-02Use c"lit" for CStrings without unwrapKornel-2/+2
2024-09-19Add str.as_str() for easy dereferencing of Box<str>Kornel-0/+4
2024-07-29Reformat `use` declarations.Nicholas Nethercote-2/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-22Generalize `{Rc,Arc}::make_mut()` to unsized types.Kevin Reid-0/+18
This requires introducing a new internal type `RcUninit` (and `ArcUninit`), which can own an `RcBox<T>` without requiring it to be initialized, sized, or a slice. This is similar to `UniqueRc`, but `UniqueRc` doesn't support the allocator parameter, and there is no `UniqueArc`.
2024-06-11`UniqueRc`: support allocators and `T: ?Sized`.Kevin Reid-0/+26
Added the following (all unstable): * Defaulted type pararameter `A: Allocator`. * `UniqueRc::new_in()`. * `T: ?Sized` where possible. * `impl CoerceUnsized for UniqueRc`. * Drive-by doc polish: links and periods at the end of sentences. These changes are motivated by supporting the implementation of unsized `Rc::make_mut()` (PR #116113), but are also intended to be obvious generalizations of `UniqueRc` to support the things `Rc` does.
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