diff options
| author | Trevor Gross <tmgross@umich.edu> | 2024-03-26 21:38:28 -0400 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2024-03-26 21:40:31 -0400 |
| commit | 0cd57725f9d624aed3cdaa3852a1f80f550ae275 (patch) | |
| tree | 289666c865bc9d089b253473984722a8978557c6 | |
| parent | a1b499134a62130871382b5ea381b2f18c5033cd (diff) | |
| download | rust-0cd57725f9d624aed3cdaa3852a1f80f550ae275.tar.gz rust-0cd57725f9d624aed3cdaa3852a1f80f550ae275.zip | |
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.
| -rw-r--r-- | library/std/src/sync/rwlock.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/library/std/src/sync/rwlock.rs b/library/std/src/sync/rwlock.rs index d648cd08994..e0a8a7603d7 100644 --- a/library/std/src/sync/rwlock.rs +++ b/library/std/src/sync/rwlock.rs @@ -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 |
