Skip to content

Commit

Permalink
Unrolled build for rust-lang#123118
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#123118 - tgross35:rwlock-docs, r=workingjubilee

Update `RwLock` deadlock example to not use shadowing

Tweak variable names in the deadlock example to remove any potential confusion that the behavior is somehow shadowing-related.
  • Loading branch information
rust-timer committed Mar 27, 2024
2 parents 435b525 + 0cd5772 commit 5f907a5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions library/std/src/sync/rwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ use crate::sys::sync as sys;
/// <details><summary>Potential deadlock example</summary>
///
/// ```text
/// // Thread 1 | // Thread 2
/// let _rg = lock.read(); |
/// | // will block
/// | let _wg = lock.write();
/// // may deadlock |
/// let _rg = lock.read(); |
/// // Thread 1 | // Thread 2
/// let _rg1 = lock.read(); |
/// | // will block
/// | let _wg = lock.write();
/// // may deadlock |
/// let _rg2 = lock.read(); |
/// ```
///
/// </details>
///
/// The type parameter `T` represents the data that this lock protects. It is
Expand Down

0 comments on commit 5f907a5

Please sign in to comment.