Skip to content

Commit 0cd5772

Browse files
committed
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.
1 parent a1b4991 commit 0cd5772

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

library/std/src/sync/rwlock.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ use crate::sys::sync as sys;
3131
/// <details><summary>Potential deadlock example</summary>
3232
///
3333
/// ```text
34-
/// // Thread 1 | // Thread 2
35-
/// let _rg = lock.read(); |
36-
/// | // will block
37-
/// | let _wg = lock.write();
38-
/// // may deadlock |
39-
/// let _rg = lock.read(); |
34+
/// // Thread 1 | // Thread 2
35+
/// let _rg1 = lock.read(); |
36+
/// | // will block
37+
/// | let _wg = lock.write();
38+
/// // may deadlock |
39+
/// let _rg2 = lock.read(); |
4040
/// ```
41+
///
4142
/// </details>
4243
///
4344
/// The type parameter `T` represents the data that this lock protects. It is

0 commit comments

Comments
 (0)