Skip to content

Commit bce5253

Browse files
authored
Rollup merge of #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.
2 parents 19a40ec + 0cd5772 commit bce5253

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Diff for: 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)