Skip to content

Commit 22ed381

Browse files
committed
Rollup merge of rust-lang#21477 - steveklabnik:gh21440, r=alexcrichton
Fixes rust-lang#21440"
2 parents 0b793ea + bbbdd10 commit 22ed381

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/libstd/sync/rwlock.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,15 @@ pub struct RwLockWriteGuard<'a, T: 'a> {
130130
impl<'a, T> !marker::Send for RwLockWriteGuard<'a, T> {}
131131

132132
impl<T: Send + Sync> RwLock<T> {
133-
/// Creates a new instance of an RwLock which is unlocked and read to go.
133+
/// Creates a new instance of an `RwLock<T>` which is unlocked.
134+
///
135+
/// # Examples
136+
///
137+
/// ```
138+
/// use std::sync::RwLock;
139+
///
140+
/// let lock = RwLock::new(5);
141+
/// ```
134142
#[stable]
135143
pub fn new(t: T) -> RwLock<T> {
136144
RwLock { inner: box RW_LOCK_INIT, data: UnsafeCell::new(t) }

0 commit comments

Comments
 (0)