]> git.lizzy.rs Git - rust.git/blobdiff - library/std/src/sys_common/mutex.rs
Rollup merge of #98385 - m-ou-se:llvm-12-memory-order, r=petrochenkov
[rust.git] / library / std / src / sys_common / mutex.rs
index 36ea888d8de499cb7d3b5a42dac69a32f11a5781..48479f5bdb3f7084dc3a98f356f0752304b01f82 100644 (file)
@@ -15,6 +15,7 @@ unsafe impl Sync for StaticMutex {}
 
 impl StaticMutex {
     /// Creates a new mutex for use.
+    #[inline]
     pub const fn new() -> Self {
         Self(imp::Mutex::new())
     }
@@ -45,13 +46,12 @@ fn drop(&mut self) {
 
 /// An OS-based mutual exclusion lock.
 ///
-/// This mutex does *not* have a const constructor, cleans up its resources in
-/// its `Drop` implementation, may safely be moved (when not borrowed), and
-/// does not cause UB when used reentrantly.
+/// This mutex cleans up its resources in its `Drop` implementation, may safely
+/// be moved (when not borrowed), and does not cause UB when used reentrantly.
 ///
 /// This mutex does not implement poisoning.
 ///
-/// This is either a wrapper around `Box<imp::Mutex>` or `imp::Mutex`,
+/// This is either a wrapper around `LazyBox<imp::Mutex>` or `imp::Mutex`,
 /// depending on the platform. It is boxed on platforms where `imp::Mutex` may
 /// not be moved.
 pub struct MovableMutex(imp::MovableMutex);
@@ -60,7 +60,8 @@ unsafe impl Sync for MovableMutex {}
 
 impl MovableMutex {
     /// Creates a new mutex.
-    pub fn new() -> Self {
+    #[inline]
+    pub const fn new() -> Self {
         Self(imp::MovableMutex::new())
     }