| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
This commit manually implements `RefUnwindSafe` for
`std::sync::Barrier` to fix 146087. This is a fix for a regression
indroduced by https://github.com/rust-lang/rust/commit/e95db591a4550e28ad92660b753ad85b89271882
|
|
Implementation: `#[feature(nonpoison_condvar)]`
Tracking Issue: https://github.com/rust-lang/rust/issues/134645
This PR continues the effort made in https://github.com/rust-lang/rust/pull/144022 by adding the implementation of `nonpoison::condvar`.
Many of the changes here are similar to the changes made to implement `nonpoison::mutex`.
There are two other changes here. The first is that the `Barrier` implementation is migrated to use the `nonpoison::Condvar` instead of the `poison` variant. The second (which might be subject to some discussion) is that `WaitTimeoutResult` is moved up to `mod.rs`, as both `condvar` variants need that type (and I do not know if there is a better place to put it now).
### Related PRs
- `nonpoison_rwlock` implementation: https://github.com/rust-lang/rust/pull/144648
- `nonpoison_once` implementation: https://github.com/rust-lang/rust/pull/144653
|
|
Fix wrong cache line size of riscv64
see https://go-review.googlesource.com/c/go/+/526659, All of riscv CPU using 64B for cache-line size.
|
|
remove deprecated Error::description in impls
[libs-api permission](https://github.com/rust-lang/libs-team/issues/615#issuecomment-3074045829)
r? `@cuviper`
or `@jhpratt`
|
|
|
|
Fix `LazyLock` poison panic message
Fixes the issue raised in https://github.com/rust-lang/rust/pull/144872#issuecomment-3151100248
r? ```@Amanieu```
|
|
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
|
|
Since `WaitTimeoutResult` is poison-agnostic, we want to use the same
type for both variants of `Condvar`.
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
|
|
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
|
|
Adds the equivalent `nonpoison` types to the `poison::condvar` module.
These types and implementations are gated under the `nonpoison_condvar`
feature gate.
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
|
|
Implementation: `#[feature(nonpoison_rwlock)]`
Tracking Issue: https://github.com/rust-lang/rust/issues/134645
This PR continues the effort made in https://github.com/rust-lang/rust/pull/144022 by adding the implementation of `nonpoison::rwlock`.
Many of the changes here are similar to the changes made to implement `nonpoison::mutex`. The only real difference is that this PR includes a reorganizing of the existing `poison::rwlock` file that hopefully makes both variants more readable.
### Related PRs
- `nonpoison_condvar` implementation: https://github.com/rust-lang/rust/pull/144651
- `nonpoison_once` implementation: https://github.com/rust-lang/rust/pull/144653
|
|
Fixes an issue where if the underlying `Once` panics because it is
poisoned, the panic displays the wrong message.
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
|
|
run spellcheck as a tidy extra check in ci
This is probably how it should've been done from the start.
r? ``@Kobzol``
|
|
|
|
Migrate the standard library from using the external `cfg_if` crate to
using the now-built-in `cfg_select` macro.
This does not yet eliminate the dependency from
`library/std/Cargo.toml`, because while the standard library itself no
longer uses `cfg_if`, it also incorporates the `backtrace` crate, which
does.
Migration assisted by the following vim command (after selecting the
full `cfg_if!` invocation):
```
'<,'>s/\(cfg_if::\)\?cfg_if/cfg_select/ | '<,'>s/^\( *\)} else {/\1}\r\1_ => {/c | '<,'>s/^\( *\)} else if #\[cfg(\(.*\))\] /\1}\r\1\2 => /e | '<,'>s/if #\[cfg(\(.*\))\] {/\1 => {/e
```
This is imperfect, but substantially accelerated the process. This
prompts for confirmation on the `} else {` since that can also appear
inside one of the arms. This also requires manual intervention to handle
any multi-line conditions.
|
|
Signed-off-by: Eval EXEC <execvy@gmail.com>
|
|
Adds the equivalent `nonpoison` types to the `poison::rwlock` module.
These types and implementations are gated under the `nonpoison_rwlock`
feature gate.
Also blesses the ui tests that now have a name conflicts (because these
types no longer have unique names). The full path distinguishes the
different types.
|
|
This commit is a purely cosmetic change to the documentation and
ordering of items in the `rwlock.rs` file, which will help discern the
actual difference between the `nonpoison` and `poison` variants of
`rwlock`.
List of changes (lots of small things):
- Clean up some of the existing field doc comments
- Add documentation for every field in struct definitions
- Consolidate related implementation blocks (1 implementation block per
guard instead of 2)
- Use the lifetime name `'rwlock` instead of `'a`
- Reorder implementation blocks to be consistent across the entire file
(follows the order `ReadGuard`, `WriteGuard`, `MappedReadGuard`,
MappedWriteGuard`)
- Move simple trait implementations to the bottom of the file
- Rename the `poison` field in `MappedRwLockWriteGuard` to
posion_guard`
- Cut off comments at 100 columns
- Update the documentation of `downgrade` to match stabilization PR #
143191
|
|
|
|
|
|
|
|
Document guarantees of poisoning
This mostly documents the current behavior of `Mutex` and `RwLock` (rust-lang/rust#143471) as imperfect. It's unlikely that the situation improves significantly in the future, and even if it does, the rules will probably be more complicated than "poisoning is completely reliable", so this is a conservative guarantee.
We also explicitly specify that `OnceLock` never poisons, even though it has an API similar to mutexes.
Fixes rust-lang/rust#143471 by improving documentation.
r? ``@Amanieu``
|
|
Adds the equivalent `nonpoison` types to the `poison::mutex` module.
These types and implementations are gated under the `nonpoison_mutex`
feature gate.
Also blesses the ui tests that now have a name conflicts (because these
types no longer have unique names). The full path distinguishes the
different types.
Co-authored-by: Aandreba <aandreba@gmail.com>
Co-authored-by: Trevor Gross <tmgross@umich.edu>
|
|
|
|
|
|
|
|
|
|
This mostly documents the current behavior of `Mutex` and `RwLock` as
imperfect. It's unlikely that the situation improves significantly in
the future, and even if it does, the rules will probably be more
complicated than "poisoning is completely reliable", so this is a
conservative guarantee.
We also explicitly specify that `OnceLock` never poisons, even though it
has an API similar to mutexes.
|
|
Typo in word "below"
|
|
awhile -> a while where appropriate
|
|
Update poison.rs to fix the typo (sys->sync)
|
|
|
|
|
|
|
|
|
|
Clarify &mut-methods' docs on sync::OnceLock
Three small changes to the docs of `sync::OnceLock`:
* The docs for `OnceLock::take()` used to [say](https://doc.rust-lang.org/std/sync/struct.OnceLock.html#method.take) "**Safety** is guaranteed by requiring a mutable reference." (emphasis mine). While technically correct, imho its not necessary to even mention safety - as opposed to unsafety - here: Safety never comes up wrt `OnceLock`, as there is (currently) no way to interact with a `OnceLock` in an unsafe way; there are no unsafe methods on `OnceLock`, so there is "safety" guarantee required anywhere. What we simply meant to say is "**Synchronization** is guaranteed...".
* I've add that phrase to the other methods of `OnceLock` which take a `&mut self`, to highlight the fact that having a `&mut OnceLock` guarantees that synchronization with other threads is not required. This is the same as with [`Mutex::get_mut()`](https://doc.rust-lang.org/std/sync/struct.Mutex.html#method.get_mut), [`Cell::get_mut()`](https://doc.rust-lang.org/std/cell/struct.Cell.html#method.get_mut), and others.
* In that spirit, the half-sentence "or being initialized" was removed from `get_mut()`, as there is no way that the `OnceLock` is being initialized while we are holding `&mut` to it. Probably a copy&paste from `.get()`
|
|
|
|
Add data_ptr method to Mutex and RwLock
Implementation of https://github.com/rust-lang/rust/issues/140368 / https://github.com/rust-lang/libs-team/issues/531.
I tried to write a useful safety section about when it is safe to read or write through the returned pointers, but couldn't come up with something nice. Hoping this PR is still useful without that. I'm happy to add any doc strings other people come up with if needed before merge, of course.
Unresolved questions:
- Return a `LockResult` or not?
- Return `*mut T` like existing APIs (`Cell::as_ptr` / `MaybeUninit::as[_mut]_ptr` / `Vec::as_ptr` / ...) or be more precise and return `NonNull<T>`?
|
|
|
|
|
|
|
|
|
|
|
|
Update documentation of OnceLock::get_or_init.
Explicitly point out that if the function panics the init function might be called multiple times.
|
|
Implement (part of) ACP 429: add `DerefMut` to `Lazy[Cell/Lock]`
`DerefMut` is instantly stable, as a trait impl. That means this needs an FCP.
``@rustbot`` label +needs-fcp
https://github.com/rust-lang/libs-team/issues/429
|
|
Explicitly point out that if the function panics the init function might
be called multiple times.
|
|
1. analogous to std::cell::Ref(Mut)::filter_map.
2. doesn't imply `Try` genericizability.
|