Skip to content

RwLock: refine documentation to emphasize non-reentrancy guarantees#152056

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
hzeller:feature-20260203-clarify-rwlock-reentrance
Feb 8, 2026
Merged

RwLock: refine documentation to emphasize non-reentrancy guarantees#152056
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
hzeller:feature-20260203-clarify-rwlock-reentrance

Conversation

@hzeller
Copy link
Contributor

@hzeller hzeller commented Feb 3, 2026

This addresses the need for clarification brought up in #149693. Specifically, it notes that some implementations may choose to panic if they detect deadlock situations during recursive locking attempts for both read() and write() calls.

  • Provide an example highlighting that multiple read locks can be held across different threads simultaneously.
  • Remove the example that shows a situation that can potentially deadlock. (as demonstrated in the very same documentation a few paragraphs above)
  • Improve documentation regarding the possibility of panics during recursive read or write lock attempts.

Issues: #149693

@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 Feb 3, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 3, 2026

r? @joboet

rustbot has assigned @joboet.
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

This comment has been minimized.

@hzeller
Copy link
Contributor Author

hzeller commented Feb 3, 2026

cc: @durin42 @tmandry

This addresses the need for clarification brought up in an issue.
Specifically, it notes that some implementations may choose to panic if
they detect deadlock situations during recursive locking attempts for
both `read()` and `write()` calls.

  * Provide an example highlighting that multiple read locks can be
    held across different threads simultaneously.
  * Remove the example that shows a situation that can potentially deadlock.
    (as demonstrated in the very same documentation a few paragraphs
    above)
  * Improve documentation regarding the possibility of panics during
    recursive read or write lock attempts.

Issues: Ambiguity in RwLock documentation about multiple read() calls...

Signed-off-by: Henner Zeller <h.zeller@acm.org>
@hzeller hzeller force-pushed the feature-20260203-clarify-rwlock-reentrance branch from df4cbf5 to 27f97d7 Compare February 3, 2026 15:50
@joboet
Copy link
Member

joboet commented Feb 7, 2026

Indeed, that's much better, thank you!
@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 7, 2026

📌 Commit 27f97d7 has been approved by joboet

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 7, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 7, 2026
…wlock-reentrance, r=joboet

RwLock: refine documentation to emphasize non-reentrancy guarantees

This addresses the need for clarification brought up in rust-lang#149693. Specifically, it notes that some implementations may choose to panic if they detect deadlock situations during recursive locking attempts for both `read()` and `write()` calls.

  * Provide an example highlighting that multiple read locks can be held across different threads simultaneously.
  * Remove the example that shows a situation that can potentially deadlock. (as demonstrated in the very same documentation a few paragraphs above)
  * Improve documentation regarding the possibility of panics during recursive read or write lock attempts.

Issues: rust-lang#149693
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 7, 2026
…wlock-reentrance, r=joboet

RwLock: refine documentation to emphasize non-reentrancy guarantees

This addresses the need for clarification brought up in rust-lang#149693. Specifically, it notes that some implementations may choose to panic if they detect deadlock situations during recursive locking attempts for both `read()` and `write()` calls.

  * Provide an example highlighting that multiple read locks can be held across different threads simultaneously.
  * Remove the example that shows a situation that can potentially deadlock. (as demonstrated in the very same documentation a few paragraphs above)
  * Improve documentation regarding the possibility of panics during recursive read or write lock attempts.

Issues: rust-lang#149693
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 7, 2026
…wlock-reentrance, r=joboet

RwLock: refine documentation to emphasize non-reentrancy guarantees

This addresses the need for clarification brought up in rust-lang#149693. Specifically, it notes that some implementations may choose to panic if they detect deadlock situations during recursive locking attempts for both `read()` and `write()` calls.

  * Provide an example highlighting that multiple read locks can be held across different threads simultaneously.
  * Remove the example that shows a situation that can potentially deadlock. (as demonstrated in the very same documentation a few paragraphs above)
  * Improve documentation regarding the possibility of panics during recursive read or write lock attempts.

Issues: rust-lang#149693
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 7, 2026
…wlock-reentrance, r=joboet

RwLock: refine documentation to emphasize non-reentrancy guarantees

This addresses the need for clarification brought up in rust-lang#149693. Specifically, it notes that some implementations may choose to panic if they detect deadlock situations during recursive locking attempts for both `read()` and `write()` calls.

  * Provide an example highlighting that multiple read locks can be held across different threads simultaneously.
  * Remove the example that shows a situation that can potentially deadlock. (as demonstrated in the very same documentation a few paragraphs above)
  * Improve documentation regarding the possibility of panics during recursive read or write lock attempts.

Issues: rust-lang#149693
rust-bors bot pushed a commit that referenced this pull request Feb 7, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #151745 (Remove a couple of unnecessary flags and env vars in bootstrap)
 - #152217 (Convert to inline diagnostics in `rustc_lint`)
 - #152056 (RwLock: refine documentation to emphasize non-reentrancy guarantees)
 - #152261 (Introduce helper `ty::Generics::has_own_self`)
 - #152288 (Allow only a single accepter per attribute)
 - #152292 (Minor change for readability)
 - #152300 (Port `rustc_regions` to the new attribute parser)
rust-bors bot pushed a commit that referenced this pull request Feb 7, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #151745 (Remove a couple of unnecessary flags and env vars in bootstrap)
 - #152217 (Convert to inline diagnostics in `rustc_lint`)
 - #152056 (RwLock: refine documentation to emphasize non-reentrancy guarantees)
 - #152261 (Introduce helper `ty::Generics::has_own_self`)
 - #152288 (Allow only a single accepter per attribute)
 - #152292 (Minor change for readability)
 - #152300 (Port `rustc_regions` to the new attribute parser)
rust-bors bot pushed a commit that referenced this pull request Feb 7, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #151745 (Remove a couple of unnecessary flags and env vars in bootstrap)
 - #152217 (Convert to inline diagnostics in `rustc_lint`)
 - #152056 (RwLock: refine documentation to emphasize non-reentrancy guarantees)
 - #152261 (Introduce helper `ty::Generics::has_own_self`)
 - #152288 (Allow only a single accepter per attribute)
 - #152292 (Minor change for readability)
 - #152300 (Port `rustc_regions` to the new attribute parser)
rust-bors bot pushed a commit that referenced this pull request Feb 7, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #151745 (Remove a couple of unnecessary flags and env vars in bootstrap)
 - #152217 (Convert to inline diagnostics in `rustc_lint`)
 - #152056 (RwLock: refine documentation to emphasize non-reentrancy guarantees)
 - #152261 (Introduce helper `ty::Generics::has_own_self`)
 - #152288 (Allow only a single accepter per attribute)
 - #152292 (Minor change for readability)
 - #152300 (Port `rustc_regions` to the new attribute parser)
@rust-bors rust-bors bot merged commit 5964330 into rust-lang:main Feb 8, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 8, 2026
rust-timer added a commit that referenced this pull request Feb 8, 2026
Rollup merge of #152056 - hzeller:feature-20260203-clarify-rwlock-reentrance, r=joboet

RwLock: refine documentation to emphasize non-reentrancy guarantees

This addresses the need for clarification brought up in #149693. Specifically, it notes that some implementations may choose to panic if they detect deadlock situations during recursive locking attempts for both `read()` and `write()` calls.

  * Provide an example highlighting that multiple read locks can be held across different threads simultaneously.
  * Remove the example that shows a situation that can potentially deadlock. (as demonstrated in the very same documentation a few paragraphs above)
  * Improve documentation regarding the possibility of panics during recursive read or write lock attempts.

Issues: #149693
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

3 participants