From 0a6b636e699f2b54d6c1ccf74dcb6d9e65a22eea Mon Sep 17 00:00:00 2001 From: Elichai Turkel Date: Wed, 27 Nov 2019 22:26:12 +0200 Subject: [PATCH] Making RWLock::new const fn --- src/libstd/sync/rwlock.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index b1b56f321fc6b..846d9742fc1f4 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -65,7 +65,7 @@ use crate::sys_common::rwlock as sys; /// [`Mutex`]: struct.Mutex.html #[stable(feature = "rust1", since = "1.0.0")] pub struct RwLock { - inner: Box, + inner: sys::RWLock, poison: poison::Flag, data: UnsafeCell, } @@ -129,9 +129,9 @@ impl RwLock { /// let lock = RwLock::new(5); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - pub fn new(t: T) -> RwLock { + pub const fn new(t: T) -> RwLock { RwLock { - inner: box sys::RWLock::new(), + inner: sys::RWLock::new(), poison: poison::Flag::new(), data: UnsafeCell::new(t), }