Skip to content

Conversation

connortsui20
Copy link
Contributor

@connortsui20 connortsui20 commented Jul 29, 2025

Tracking Issue: #134645

This PR continues the effort made in #144022 by adding the implementation of nonpoison::once.

Many of the changes here are similar to the changes made to implement nonpoison::mutex.

Note that even though there were FIXMEs for changing OnceLock and LazyLock to use the nonpoison variant, that is not correct as both rely on poisoning behavior to operate correctly.

Related PRs

@rustbot
Copy link
Collaborator

rustbot commented Jul 29, 2025

r? @ChrisDenton

rustbot has assigned @ChrisDenton.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 29, 2025
@rust-log-analyzer

This comment has been minimized.

jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 22, 2025
…ark-Simulacrum

Implementation: `#[feature(nonpoison_rwlock)]`

Tracking Issue: rust-lang#134645

This PR continues the effort made in rust-lang#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: rust-lang#144651
- `nonpoison_once` implementation: rust-lang#144653
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 23, 2025
…ark-Simulacrum

Implementation: `#[feature(nonpoison_rwlock)]`

Tracking Issue: rust-lang#134645

This PR continues the effort made in rust-lang#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: rust-lang#144651
- `nonpoison_once` implementation: rust-lang#144653
@ChrisDenton
Copy link
Member

Sorry for the delay, I've not been keep up with reviews atm. I'll assign another reviewer.

r? libs

rust-timer added a commit that referenced this pull request Aug 23, 2025
Rollup merge of #144648 - connortsui20:nonpoison_rwlock, r=Mark-Simulacrum

Implementation: `#[feature(nonpoison_rwlock)]`

Tracking Issue: #134645

This PR continues the effort made in #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: #144651
- `nonpoison_once` implementation: #144653
@bors
Copy link
Collaborator

bors commented Aug 23, 2025

☔ The latest upstream changes (presumably #145773) made this pull request unmergeable. Please resolve the merge conflicts.

Adds the equivalent `nonpoison` types to the `poison::once` module.
These types and implementations are gated under the `nonpoison_once`
feature gate.

Signed-off-by: Connor Tsui <[email protected]>
Both implementations require poisoning support.

Signed-off-by: Connor Tsui <[email protected]>
@rustbot
Copy link
Collaborator

rustbot commented Aug 23, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Copy link
Contributor Author

@connortsui20 connortsui20 Aug 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reviewers: it might be good to compare this directly with the poison::once module.

(for copy paste)

delta library/std/src/sync/poison/once.rs library/std/src/sync/nonpoison/once.rs
diff library/std/src/sync/poison/once.rs library/std/src/sync/nonpoison/once.rs

github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 24, 2025
…acrum

Implementation: `#[feature(nonpoison_rwlock)]`

Tracking Issue: rust-lang/rust#134645

This PR continues the effort made in rust-lang/rust#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: rust-lang/rust#144651
- `nonpoison_once` implementation: rust-lang/rust#144653
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Aug 25, 2025
…acrum

Implementation: `#[feature(nonpoison_rwlock)]`

Tracking Issue: rust-lang/rust#134645

This PR continues the effort made in rust-lang/rust#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: rust-lang/rust#144651
- `nonpoison_once` implementation: rust-lang/rust#144653
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Aug 26, 2025
…ark-Simulacrum

Implementation: `#[feature(nonpoison_rwlock)]`

Tracking Issue: rust-lang#134645

This PR continues the effort made in rust-lang#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: rust-lang#144651
- `nonpoison_once` implementation: rust-lang#144653
#[inline]
#[unstable(feature = "nonpoison_once", issue = "134645")]
#[track_caller]
pub fn call_once<F>(&self, f: F)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has the exact same behavior as the poison::Once::call_once_force method. Could that be confusing (since it is named differently but is identical)?

/// [`call_once()`]: Once::call_once
/// [`poison::Once::wait_force`]: crate::sync::poison::Once::wait_force
#[unstable(feature = "nonpoison_once", issue = "134645")]
pub fn wait(&self) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, this has the same behavior as wait_force.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that there are no "new" tests here, just refactored tests for the macro

Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 30, 2025
…joboet

Implementation: `#[feature(nonpoison_condvar)]`

Tracking Issue: rust-lang#134645

This PR continues the effort made in rust-lang#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: rust-lang#144648
- `nonpoison_once` implementation: rust-lang#144653
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants