about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2024-11-20Stabilize const_pin_2George Bateman-4/+4
2024-11-20re-export `is_loongarch_feature_detected`WANG Rui-0/+2
2024-11-20Rollup merge of #132732 - gavincrawford:as_ptr_attribute, r=UrgauJacob Pratt-0/+16
Use attributes for `dangling_pointers_from_temporaries` lint Checking for dangling pointers by function name isn't ideal, and leaves out certain pointer-returning methods that don't follow the `as_ptr` naming convention. Using an attribute for this lint cleans things up and allows more thorough coverage of other methods, such as `UnsafeCell::get()`.
2024-11-19UniqueRc: platform-specific AsFd/Handle/etc impls to mirror RcZachary S-0/+33
2024-11-19UniqueRc: PinCoerceUnsized and DerefPureZachary S-3/+8
2024-11-19UniqueRc: comparisons and HashZachary S-0/+173
2024-11-19Rollup merge of #133183 - n0toose:improve-remove-dir-docs, r=joboetMatthias Krüger-0/+4
Mention std::fs::remove_dir_all in std::fs::remove_dir
2024-11-19Rollup merge of #125405 - m-ou-se:thread-add-spawn-hook, r=WaffleLapkinMatthias Krüger-7/+186
Add std::thread::add_spawn_hook. Implementation of https://github.com/rust-lang/rfcs/pull/3642
2024-11-19Rollup merge of #123947 - zopsicle:vec_deque-Iter-as_slices, r=AmanieuMatthias Krüger-0/+142
Add vec_deque::Iter::as_slices and friends Add the following methods, that work similarly to VecDeque::as_slices: - alloc::collections::vec_deque::Iter::as_slices - alloc::collections::vec_deque::IterMut::into_slices - alloc::collections::vec_deque::IterMut::as_slices - alloc::collections::vec_deque::IterMut::as_mut_slices Obtaining slices from a VecDeque iterator was not previously possible.
2024-11-19UniqueRc: Add more trait impls.Zachary S-1/+68
* Support the same formatting as Rc * Add explicit !Send and !Sync impls, to mirror Rc * DispatchFromDyn * borrowing traits and Unpin
2024-11-19Update doc comments for spawn hook.Mara Bos-2/+6
2024-11-19Address review comments.Mara Bos-7/+6
Co-authored-by: waffle <waffle.lapkin@gmail.com>
2024-11-19Fix tracking issue.Mara Bos-1/+1
2024-11-19Add tracking issue.Mara Bos-2/+2
2024-11-19Use Send + Sync for spawn hooks.Mara Bos-2/+2
2024-11-19Add thread Builder::no_hooks().Mara Bos-7/+24
2024-11-19Update thread spawn hooks.Mara Bos-37/+86
1. Make the effect thread local. 2. Don't return a io::Result from hooks.
2024-11-19Use add_spawn_hook for libtest's output capturing.Mara Bos-4/+11
2024-11-19Add std::thread::add_spawn_hook.Mara Bos-0/+103
2024-11-19Correct comments concerning updated dangling pointer lintgavincrawford-1/+1
2024-11-19Auto merge of #133205 - matthiaskrgr:rollup-xhhhp5u, r=matthiaskrgrbors-0/+3
Rollup of 4 pull requests Successful merges: - #131081 (Use `ConstArgKind::Path` for all single-segment paths, not just params under `min_generic_const_args`) - #132577 (Report the `unexpected_cfgs` lint in external macros) - #133023 (Merge `-Zhir-stats` into `-Zinput-stats`) - #133200 (ignore an occasionally-failing test in Miri) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-19Rollup merge of #133200 - RalfJung:miri-rwlock-test, r=tgross35Matthias Krüger-0/+3
ignore an occasionally-failing test in Miri This is like https://github.com/rust-lang/rust/pull/128640, the test [sometimes](https://github.com/rust-lang/rust/pull/133189) fails due to https://github.com/rust-lang/rust/issues/121950.
2024-11-19ignore an occasionally-failing test in MiriRalf Jung-0/+3
2024-11-19Rollup merge of #133182 - RalfJung:const-panic-inline, r=tgross35León Orell Valerian Liehr-1/+1
const_panic: inline in bootstrap builds to avoid f16/f128 crashes This should fix https://github.com/rust-lang/rust/issues/133177. ``@uweigand`` could you test that?
2024-11-19Rollup merge of #132758 - nnethercote:improve-get_key_value-docs, r=cuviperLeón Orell Valerian Liehr-8/+78
Improve `{BTreeMap,HashMap}::get_key_value` docs. They are unusual methods. The docs don't really describe the cases when they might be useful (as opposed to just `get`), and the examples don't demonstrate the interesting cases at all. This commit improves the docs and the examples.
2024-11-18Mention std::fs::remove_dir_all in std::fs::remove_dirPanagiotis "Ivory" Vasilopoulos-0/+4
2024-11-18wasi/fs: Improve stopping condition for <ReadDir as Iterator>::nextPiotr Osiewicz-14/+17
When upgrading [Zed](https://github.com/zed-industries/zed/pull/19349) to Rust 1.82 I've encountered a test failure in our test suite. Specifically, one of our extension tests started hanging. I've tracked it down to a call to std::fs::remove_dir_all not returning when an extension is compiled with Rust 1.82 Our extension system uses WASM components, thus I've looked at the diff between 1.81 and 1.82 with respect to WASI and found 736f773844e7ebf05ccb827c17b7ad9eb28aa295 As it turned out, calling remove_dir_all from extension returned io::ErrorKind::NotFound in 1.81; the underlying issue is that the ReadDir iterator never actually terminates iteration, however since it loops around, with 1.81 we'd come across an entry second time and fail to remove it, since it would've been removed previously. With 1.82 and 736f773844e7ebf05ccb827c17b7ad9eb28aa295 it is no longer the case, thus we're seeing the hang. This commit makes ReadDir::next adhere to readdir contract, namely it will no longer call readdir once the returned # of bytes is smaller than the size of a passed-in buffer. Previously we'd only terminate the loop if readdir returned 0.
2024-11-18Bump `stdarch` to the latest masterUrgau-0/+0
2024-11-18const_panic: inline in bootstrap builds to avoid f16/f128 crashesRalf Jung-1/+1
2024-11-18std: allow after-main use of synchronization primitivesjoboet-26/+59
By creating an unnamed thread handle when the actual one has already been destroyed, synchronization primitives using thread parking can be used even outside the Rust runtime. This also fixes an inefficiency in the queue-based `RwLock`: if `thread::current` was not initialized yet, it will create a new handle on every parking attempt without initializing `thread::current`. The private `current_or_unnamed` function introduced here fixes this.
2024-11-18Auto merge of #133160 - jhpratt:rollup-wzj9q15, r=jhprattbors-48/+54
Rollup of 4 pull requests Successful merges: - #132934 (Overhaul the `-l` option parser (for linking to native libs)) - #133142 (rename rustc_const_stable_intrinsic -> rustc_intrinsic_const_stable_indirect) - #133145 (Document alternatives to `static mut`) - #133158 (Subtree update of `rust-analyzer`) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-18Rollup merge of #133145 - kornelski:static-mutex, r=traviscrossJacob Pratt-0/+6
Document alternatives to `static mut` In #133143 I've noticed alternatives to `static mut` aren't documented anywhere.
2024-11-18Auto merge of #128219 - connortsui20:rwlock-downgrade, r=tgross35bors-261/+662
Rwlock downgrade Tracking Issue: #128203 This PR adds a `downgrade` method for `RwLock` / `RwLockWriteGuard` on all currently supported platforms. Outstanding questions: - [x] ~~Does the `futex.rs` change affect performance at all? It doesn't seem like it will but we can't be certain until we bench it...~~ - [x] ~~Should the SOLID platform implementation [be ported over](https://github.com/rust-lang/rust/pull/128219#discussion_r1693470090) to the `queue.rs` implementation to allow it to support downgrades?~~
2024-11-18rename rustc_const_stable_intrinsic -> rustc_intrinsic_const_stable_indirectRalf Jung-48/+48
2024-11-18Improve `{BTreeMap,HashMap}::get_key_value` docs.Nicholas Nethercote-8/+78
They are unusual methods. The docs don't really describe the cases when they might be useful (as opposed to just `get`), and the examples don't demonstrate the interesting cases at all. This commit improves the docs and the examples.
2024-11-18Document alternatives to `static mut`Kornel-0/+6
2024-11-17Auto merge of #120370 - x17jiri:likely_unlikely_fix, r=saethlinbors-8/+40
Likely unlikely fix RFC 1131 ( https://github.com/rust-lang/rust/issues/26179 ) added likely/unlikely intrinsics, but they have been broken for a while: https://github.com/rust-lang/rust/issues/96276 , https://github.com/rust-lang/rust/issues/96275 , https://github.com/rust-lang/rust/issues/88767 . This PR tries to fix them. Changes: - added a new `cold_path()` intrinsic - `likely()` and `unlikely()` changed to regular functions implemented using `cold_path()`
2024-11-17Likely unlikely fixJiri Bobek-8/+40
2024-11-17Rollup merge of #133126 - ohno418:fix-String-doc, r=jhpratt许杰友 Jieyou Xu (Joe)-1/+1
alloc: fix `String`'s doc Just a minor fix for `String` struct.
2024-11-17Rollup merge of #133116 - RalfJung:const-null-ptr, r=dtolnay许杰友 Jieyou Xu (Joe)-33/+36
stabilize const_ptr_is_null FCP passed in https://github.com/rust-lang/rust/issues/74939. The second commit cleans up const stability around UB checks a bit, now that everything they need (except for `const_eval_select`) is stable. Fixes https://github.com/rust-lang/rust/issues/74939
2024-11-17alloc: fix `String`'s docYutaro Ohno-1/+1
2024-11-16clean up const stability around UB checksRalf Jung-24/+26
2024-11-16stabilize const_ptr_is_nullRalf Jung-10/+11
2024-11-16Add `DerefMut` for `Lazy[Cell/Lock]` that delegates to the unstable ↵Chayim Refael Friedman-2/+18
`force_mut()`
2024-11-16Rollup merge of #132449 - RalfJung:is_val_statically_known, r=compiler-errorsMatthias Krüger-9/+5
mark is_val_statically_known intrinsic as stably const-callable The intrinsic doesn't actually "do" anything in terms of language semantics, and we are already using it in stable const fn. So let's just properly mark it as stably const-callable to avoid needing `rustc_allow_const_fn_unstable` (and thus reducing noise and keeping the remaining `rustc_allow_const_fn_unstable` as a more clear signal). Cc `@rust-lang/lang` usually you have to approve exposing intrinsics in const, but this intrinsic is basically just a compiler implementation detail. So FCP doesn't seem necessary. Cc `@rust-lang/wg-const-eval`
2024-11-16Rollup merge of #131717 - tgross35:stabilize-const_atomic_from_ptr, r=RalfJungMatthias Krüger-3/+3
Stabilize `const_atomic_from_ptr` The API is already stable since https://github.com/rust-lang/rust/pull/115719, but const stability was blocked on `const_mut_refs`. Since that was recently stabilized, const stabilize the following: ```rust // core::atomic impl AtomicBool { pub const unsafe fn from_ptr<'a>(ptr: *mut bool) -> &'a AtomicBool; } impl<T> AtomicPtr<T> { pub const unsafe fn from_ptr<'a>(ptr: *mut *mut T) -> &'a AtomicPtr<T>; } impl AtomicU8 { pub const unsafe fn from_ptr<'a>(ptr: *mut u8) -> &'a AtomicU8; } impl AtomicU16 { pub const unsafe fn from_ptr<'a>(ptr: *mut u16) -> &'a AtomicU16; } impl AtomicU32 { pub const unsafe fn from_ptr<'a>(ptr: *mut u32) -> &'a AtomicU32; } impl AtomicU64 { pub const unsafe fn from_ptr<'a>(ptr: *mut u64) -> &'a AtomicU64; } impl AtomicUsize { pub const unsafe fn from_ptr<'a>(ptr: *mut usize) -> &'a AtomicUsize; } impl AtomicI8 { pub const unsafe fn from_ptr<'a>(ptr: *mut i8) -> &'a AtomicI8; } impl AtomicI16 { pub const unsafe fn from_ptr<'a>(ptr: *mut i16) -> &'a AtomicI16; } impl AtomicI32 { pub const unsafe fn from_ptr<'a>(ptr: *mut i32) -> &'a AtomicI32; } impl AtomicI64 { pub const unsafe fn from_ptr<'a>(ptr: *mut i64) -> &'a AtomicI64; } impl AtomicIsize { pub const unsafe fn from_ptr<'a>(ptr: *mut isize) -> &'a AtomicIsize; } ```
2024-11-16reduce threads in downgrade testConnor Tsui-1/+1
2024-11-16fix `DOWNGRADED` bit unpreservedConnor Tsui-3/+3
Co-authored-by: Jonas Böttiger <jonasboettiger@icloud.com>
2024-11-16fix memory ordering bug + bad testConnor Tsui-48/+33
This commit fixes a memory ordering bug in the futex implementation (`Relaxed` -> `Release` on `downgrade`). This commit also removes a badly written test that deadlocked and replaces it with a more reasonable test based on an already-tested `downgrade` test from the parking-lot crate.
2024-11-16add safety comments for queue implementationConnor Tsui-13/+25