about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-03-27 05:21:18 +0100
committerGitHub <noreply@github.com>2024-03-27 05:21:18 +0100
commitbce525323d98a397426f69b90d443385963e5879 (patch)
tree15af69999eb8e2acec4b5b7e05f9c4a83e504533
parent19a40ec5bf41d4bf5a8635be511ac9cb84308f25 (diff)
parent0cd57725f9d624aed3cdaa3852a1f80f550ae275 (diff)
downloadrust-bce525323d98a397426f69b90d443385963e5879.tar.gz
rust-bce525323d98a397426f69b90d443385963e5879.zip
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.
-rw-r--r--library/std/src/sync/rwlock.rs13
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