about summary refs log tree commit diff
path: root/library/alloc/src/sync/tests.rs
AgeCommit message (Collapse)AuthorLines
2024-12-04Move some alloc tests to the alloctests cratebjorn3-717/+0
Unit tests directly inside of standard library crates require a very fragile way of building that is hard to reproduce outside of bootstrap.
2024-12-02Use c"lit" for CStrings without unwrapKornel-2/+2
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
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-25Detect unused structs which derived Defaultmu001999-1/+1
2024-01-28Fix some `Arc` allocator leaksWim Looman-5/+60
This doesn't matter for the stable `Global` allocator as it is a ZST singleton, but other allocators may rely on all instances being dropped.
2023-12-10remove redundant importssurechen-11/+2
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-01-22Add Arc::into_inner for safely discarding Arcs without calling the ↵Frank Steffahn-0/+32
destructor on the inner type. Mainly rebased and squashed from PR rust-lang/rust#79665, furthermore includes minor changes in comments.
2022-08-18add some Miri-only testsRalf Jung-0/+19
2022-05-29Use Box::new() instead of box syntax in alloc testsest31-5/+5
2022-03-10Use implicit capture syntax in format_argsT-O-R-U-S-4/+4
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-16Rollup merge of #80764 - CAD97:weak-unsized-as-ptr-again, r=RalfJungMara Bos-0/+41
Re-stabilize Weak::as_ptr and friends for unsized T As per [T-lang consensus](https://hackmd.io/7r3_is6uTz-163fsOV8Vfg), 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) and not _obviously_ better (as it requires using `wrapping_offset` rather than `offset` more). <details><summary>Basically said optimization</summary> Specialize on `T: Sized`: ```rust fn as_ptr(&self) -> *const T { if [ T is Sized ] || !is_dangling(ptr) { (ptr as *mut T).set_ptr_value( (ptr as *mut u8).wrapping_offset(data_offset) ) } else { ptr::null() } } fn from_raw(*const T) -> Self { if [ T is Sized ] || !ptr.is_null() { let ptr = (ptr as *mut RcBox).set_ptr_value( (ptr as *mut u8).wrapping_offset(-data_offset) ); Weak { ptr } } else { Weak::new() } } ``` (but with more `set_ptr_value` to avoid `Sized` restrictions and maintain metadata.) Written in this fashion, this is not a correctness-critical specialization (i.e. so long as `[ T is Sized ]` is false for unsized `T`, it can be `rand()` for sized `T` without breaking correctness), but it's still touchy, so I'd rather do it in another PR with separate review. --- </details> This effectively reverts #80422 and re-establishes #74160. T-libs [previously signed off](https://github.com/rust-lang/rust/pull/74160#issuecomment-660539373) on this stable API change in #74160.
2021-01-13deprecate atomic::spin_loop_hint in favour of hint::spin_loopAshley Mannix-1/+1
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-14add missing newlineDPC-1/+1
2020-08-13Add Arc::new_cyclicDPC-0/+67
2020-07-27mv std libs to library/mark-0/+494