Implementation: #[feature(nonpoison_rwlock)]#144648
Merged
bors merged 4 commits intorust-lang:masterfrom Aug 23, 2025
Merged
Conversation
Collaborator
|
rustbot has assigned @Mark-Simulacrum. Use |
This comment has been minimized.
This comment has been minimized.
135e052 to
3bdfb3a
Compare
This was referenced Jul 29, 2025
EFanZh
reviewed
Jul 30, 2025
3bdfb3a to
21a0262
Compare
connortsui20
commented
Jul 30, 2025
Contributor
Author
There was a problem hiding this comment.
For reviewers: since this is a large file, it might be good to compare this directly with the poison::rwlock module (with the additional reorganizations made in the first commit)
(for copy paste)
delta library/std/src/sync/poison/rwlock.rs library/std/src/sync/nonpoison/rwlock.rsdiff library/std/src/sync/poison/rwlock.rs library/std/src/sync/nonpoison/rwlock.rs
Collaborator
|
☔ The latest upstream changes (presumably #145126) made this pull request unmergeable. Please resolve the merge conflicts. |
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
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 simply helps discern the actual changes needed to test both poison and nonpoison `rwlock`s.
Adds tests for the `nonpoison::RwLock` variant by using a macro to duplicate the existing `poison` tests. Note that all of the tests here are adapted from the existing `poison` tests.
21a0262 to
ad499d0
Compare
Member
|
@bors r+ |
Collaborator
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
bors
added a commit
that referenced
this pull request
Aug 23, 2025
Rollup of 20 pull requests Successful merges: - #132087 (Fix overly restrictive lifetime in `core::panic::Location::file` return type) - #137396 (Recover `param: Ty = EXPR`) - #142185 (Convert moves of references to copies in ReferencePropagation) - #144443 (Make target pointer width in target json an integer) - #144648 (Implementation: `#[feature(nonpoison_rwlock)]`) - #144897 (print raw lifetime idents with r#) - #145218 ([Debuginfo] improve enum value formatting in LLDB for better readability) - #145380 (Add codegen-llvm regression tests) - #145573 (Add an experimental unsafe(force_target_feature) attribute.) - #145597 (resolve: Remove `ScopeSet::Late`) - #145641 (On E0277, point at type that doesn't implement bound) - #145669 (rustdoc-search: GUI tests check for `//` in URL) - #145695 (Introduce ProjectionElem::try_map.) - #145710 (Fix the ABI parameter inconsistency issue in debug.rs for LoongArch64) - #145726 (Experiment: Reborrow trait) - #145731 (Make raw pointers work in type-based search) - #145736 (triagebot: Update style team reviewers) - #145738 (Uplift rustc_mir_transform::coverage::counters::union_find to rustc_data_structures.) - #145743 (doc: fix some typos in comment) - #145745 (tests: Ignore basic-stepping.rs on LoongArch) Failed merges: - #145670 (port `sanitize` attribute to the new parsing infrastructure) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
that referenced
this pull request
Aug 23, 2025
Rollup of 28 pull requests Successful merges: - #132087 (Fix overly restrictive lifetime in `core::panic::Location::file` return type) - #137396 (Recover `param: Ty = EXPR`) - #137457 (Fix host code appearing in Wasm binaries) - #142185 (Convert moves of references to copies in ReferencePropagation) - #144648 (Implementation: `#[feature(nonpoison_rwlock)]`) - #144897 (print raw lifetime idents with r#) - #145218 ([Debuginfo] improve enum value formatting in LLDB for better readability) - #145380 (Add codegen-llvm regression tests) - #145573 (Add an experimental unsafe(force_target_feature) attribute.) - #145597 (resolve: Remove `ScopeSet::Late`) - #145633 (Fix some typos in LocalKey documentation) - #145641 (On E0277, point at type that doesn't implement bound) - #145669 (rustdoc-search: GUI tests check for `//` in URL) - #145695 (Introduce ProjectionElem::try_map.) - #145710 (Fix the ABI parameter inconsistency issue in debug.rs for LoongArch64) - #145726 (Experiment: Reborrow trait) - #145731 (Make raw pointers work in type-based search) - #145736 (triagebot: Update style team reviewers) - #145738 (Uplift rustc_mir_transform::coverage::counters::union_find to rustc_data_structures.) - #145742 (rustdoc js: Even more typechecking improvments ) - #145743 (doc: fix some typos in comment) - #145745 (tests: Ignore basic-stepping.rs on LoongArch) - #145747 (Refactor lint buffering to avoid requiring a giant enum) - #145751 (fix(lexer): Allow '-' in the frontmatter infostring continue set) - #145761 (Add aarch64_be-unknown-hermit target) - #145762 (convert strings to symbols in attr diagnostics) - #145763 (Ship LLVM tools for the correct target when cross-compiling) - #145765 (Revert suggestions for missing methods in tuples) r? `@ghost` `@rustbot` modify labels: rollup
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
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
Aug 24, 2025
Rollup of 28 pull requests Successful merges: - rust-lang/rust#132087 (Fix overly restrictive lifetime in `core::panic::Location::file` return type) - rust-lang/rust#137396 (Recover `param: Ty = EXPR`) - rust-lang/rust#137457 (Fix host code appearing in Wasm binaries) - rust-lang/rust#142185 (Convert moves of references to copies in ReferencePropagation) - rust-lang/rust#144648 (Implementation: `#[feature(nonpoison_rwlock)]`) - rust-lang/rust#144897 (print raw lifetime idents with r#) - rust-lang/rust#145218 ([Debuginfo] improve enum value formatting in LLDB for better readability) - rust-lang/rust#145380 (Add codegen-llvm regression tests) - rust-lang/rust#145573 (Add an experimental unsafe(force_target_feature) attribute.) - rust-lang/rust#145597 (resolve: Remove `ScopeSet::Late`) - rust-lang/rust#145633 (Fix some typos in LocalKey documentation) - rust-lang/rust#145641 (On E0277, point at type that doesn't implement bound) - rust-lang/rust#145669 (rustdoc-search: GUI tests check for `//` in URL) - rust-lang/rust#145695 (Introduce ProjectionElem::try_map.) - rust-lang/rust#145710 (Fix the ABI parameter inconsistency issue in debug.rs for LoongArch64) - rust-lang/rust#145726 (Experiment: Reborrow trait) - rust-lang/rust#145731 (Make raw pointers work in type-based search) - rust-lang/rust#145736 (triagebot: Update style team reviewers) - rust-lang/rust#145738 (Uplift rustc_mir_transform::coverage::counters::union_find to rustc_data_structures.) - rust-lang/rust#145742 (rustdoc js: Even more typechecking improvments ) - rust-lang/rust#145743 (doc: fix some typos in comment) - rust-lang/rust#145745 (tests: Ignore basic-stepping.rs on LoongArch) - rust-lang/rust#145747 (Refactor lint buffering to avoid requiring a giant enum) - rust-lang/rust#145751 (fix(lexer): Allow '-' in the frontmatter infostring continue set) - rust-lang/rust#145761 (Add aarch64_be-unknown-hermit target) - rust-lang/rust#145762 (convert strings to symbols in attr diagnostics) - rust-lang/rust#145763 (Ship LLVM tools for the correct target when cross-compiling) - rust-lang/rust#145765 (Revert suggestions for missing methods in tuples) r? `@ghost` `@rustbot` modify labels: rollup
github-actions bot
pushed a commit
to rust-lang/rustc-dev-guide
that referenced
this pull request
Aug 25, 2025
Rollup of 28 pull requests Successful merges: - rust-lang/rust#132087 (Fix overly restrictive lifetime in `core::panic::Location::file` return type) - rust-lang/rust#137396 (Recover `param: Ty = EXPR`) - rust-lang/rust#137457 (Fix host code appearing in Wasm binaries) - rust-lang/rust#142185 (Convert moves of references to copies in ReferencePropagation) - rust-lang/rust#144648 (Implementation: `#[feature(nonpoison_rwlock)]`) - rust-lang/rust#144897 (print raw lifetime idents with r#) - rust-lang/rust#145218 ([Debuginfo] improve enum value formatting in LLDB for better readability) - rust-lang/rust#145380 (Add codegen-llvm regression tests) - rust-lang/rust#145573 (Add an experimental unsafe(force_target_feature) attribute.) - rust-lang/rust#145597 (resolve: Remove `ScopeSet::Late`) - rust-lang/rust#145633 (Fix some typos in LocalKey documentation) - rust-lang/rust#145641 (On E0277, point at type that doesn't implement bound) - rust-lang/rust#145669 (rustdoc-search: GUI tests check for `//` in URL) - rust-lang/rust#145695 (Introduce ProjectionElem::try_map.) - rust-lang/rust#145710 (Fix the ABI parameter inconsistency issue in debug.rs for LoongArch64) - rust-lang/rust#145726 (Experiment: Reborrow trait) - rust-lang/rust#145731 (Make raw pointers work in type-based search) - rust-lang/rust#145736 (triagebot: Update style team reviewers) - rust-lang/rust#145738 (Uplift rustc_mir_transform::coverage::counters::union_find to rustc_data_structures.) - rust-lang/rust#145742 (rustdoc js: Even more typechecking improvments ) - rust-lang/rust#145743 (doc: fix some typos in comment) - rust-lang/rust#145745 (tests: Ignore basic-stepping.rs on LoongArch) - rust-lang/rust#145747 (Refactor lint buffering to avoid requiring a giant enum) - rust-lang/rust#145751 (fix(lexer): Allow '-' in the frontmatter infostring continue set) - rust-lang/rust#145761 (Add aarch64_be-unknown-hermit target) - rust-lang/rust#145762 (convert strings to symbols in attr diagnostics) - rust-lang/rust#145763 (Ship LLVM tools for the correct target when cross-compiling) - rust-lang/rust#145765 (Revert suggestions for missing methods in tuples) r? `@ghost` `@rustbot` modify labels: rollup
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
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
rust-timer
added a commit
that referenced
this pull request
Aug 30, 2025
Rollup merge of #144651 - connortsui20:nonpoison_condvar, r=joboet Implementation: `#[feature(nonpoison_condvar)]` Tracking Issue: #134645 This PR continues the effort made in #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: #144648 - `nonpoison_once` implementation: #144653
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
Sep 9, 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
RalfJung
reviewed
Sep 11, 2025
Comment on lines
53
to
+54
| #[cfg_attr(all(miri, target_os = "macos"), ignore)] | ||
| fn frob() { | ||
| const N: u32 = 10; | ||
| const M: usize = if cfg!(miri) { 100 } else { 1000 }; | ||
| nonpoison_and_poison_unwrap_test!( |
Member
There was a problem hiding this comment.
This does not work, the ignore attribute does not end up getting applied properly.
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Sep 12, 2025
rwlock tests: fix miri macos test regression rust-lang#144648 broke the attributes that ignore the tests on Miri; this patch should fix that.
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Sep 12, 2025
…r=RalfJung fix cfg for poison test macro Fixes test regression in rust-lang#144648 Continuation of rust-lang#146433 I think this is right? Not really sure how to test this myself to be honest. r? `@RalfJung` I'll also leave the improvement to the test macro for a separate PR (described [here](rust-lang#146433 (comment))) since I've never done something like that before. Though since this fixes all of the tests, it might not be necessary since anyone in the future will see the `cfg()` and not `cfg_attr()`?
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Sep 12, 2025
rwlock tests: fix miri macos test regression rust-lang#144648 broke the attributes that ignore the tests on Miri; this patch should fix that.
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Sep 12, 2025
…r=RalfJung fix cfg for poison test macro Fixes test regression in rust-lang#144648 Continuation of rust-lang#146433 I think this is right? Not really sure how to test this myself to be honest. r? ``@RalfJung`` I'll also leave the improvement to the test macro for a separate PR (described [here](rust-lang#146433 (comment))) since I've never done something like that before. Though since this fixes all of the tests, it might not be necessary since anyone in the future will see the `cfg()` and not `cfg_attr()`?
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Sep 12, 2025
rwlock tests: fix miri macos test regression rust-lang#144648 broke the attributes that ignore the tests on Miri; this patch should fix that.
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Sep 12, 2025
…r=RalfJung fix cfg for poison test macro Fixes test regression in rust-lang#144648 Continuation of rust-lang#146433 I think this is right? Not really sure how to test this myself to be honest. r? ```@RalfJung``` I'll also leave the improvement to the test macro for a separate PR (described [here](rust-lang#146433 (comment))) since I've never done something like that before. Though since this fixes all of the tests, it might not be necessary since anyone in the future will see the `cfg()` and not `cfg_attr()`?
rust-timer
added a commit
that referenced
this pull request
Sep 12, 2025
Rollup merge of #146439 - connortsui20:fix-sync-macro-attr, r=RalfJung fix cfg for poison test macro Fixes test regression in #144648 Continuation of #146433 I think this is right? Not really sure how to test this myself to be honest. r? ```@RalfJung``` I'll also leave the improvement to the test macro for a separate PR (described [here](#146433 (comment))) since I've never done something like that before. Though since this fixes all of the tests, it might not be necessary since anyone in the future will see the `cfg()` and not `cfg_attr()`?
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
Sep 13, 2025
rwlock tests: fix miri macos test regression rust-lang/rust#144648 broke the attributes that ignore the tests on Miri; this patch should fix that.
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
Sep 13, 2025
fix cfg for poison test macro Fixes test regression in rust-lang/rust#144648 Continuation of rust-lang/rust#146433 I think this is right? Not really sure how to test this myself to be honest. r? ```@RalfJung``` I'll also leave the improvement to the test macro for a separate PR (described [here](rust-lang/rust#146433 (comment))) since I've never done something like that before. Though since this fixes all of the tests, it might not be necessary since anyone in the future will see the `cfg()` and not `cfg_attr()`?
8 tasks
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
Oct 9, 2025
rwlock tests: fix miri macos test regression rust-lang#144648 broke the attributes that ignore the tests on Miri; this patch should fix that.
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
Oct 9, 2025
…r=RalfJung fix cfg for poison test macro Fixes test regression in rust-lang#144648 Continuation of rust-lang#146433 I think this is right? Not really sure how to test this myself to be honest. r? ```@RalfJung``` I'll also leave the improvement to the test macro for a separate PR (described [here](rust-lang#146433 (comment))) since I've never done something like that before. Though since this fixes all of the tests, it might not be necessary since anyone in the future will see the `cfg()` and not `cfg_attr()`?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 existingpoison::rwlockfile that hopefully makes both variants more readable.Related PRs
nonpoison_condvarimplementation: Implementation:#[feature(nonpoison_condvar)]#144651nonpoison_onceimplementation: Implementation:#[feature(nonpoison_once)]#144653