]> git.lizzy.rs Git - rust.git/commitdiff
Add `OnceCell<T>: !Sync` impl for diagnostics
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>
Mon, 16 Jan 2023 17:50:45 +0000 (18:50 +0100)
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>
Thu, 19 Jan 2023 19:14:21 +0000 (20:14 +0100)
library/core/src/cell/once.rs

index 7757068a4f2b97cbdbf606c90078e1d0fc3925ff..f74e563f1b9c0bc5ef8de2f77929c36c4d5633f9 100644 (file)
@@ -298,3 +298,7 @@ fn from(value: T) -> Self {
         OnceCell { inner: UnsafeCell::new(Some(value)) }
     }
 }
+
+// Just like for `Cell<T>` this isn't needed, but results in nicer error messages.
+#[unstable(feature = "once_cell", issue = "74465")]
+impl<T> !Sync for OnceCell<T> {}