]> git.proxmox.com Git - rustc.git/blobdiff - vendor/once_cell/src/lib.rs
Merge 1.70 into proxmox/bookworm
[rustc.git] / vendor / once_cell / src / lib.rs
index 83149ac4f67fb6ffd0c7981c0659d7ab95c1de27..c2061f89f9adaca4f0477eb7a28d497cb862df3e 100644 (file)
@@ -454,7 +454,10 @@ pub mod unsync {
         /// Returns `None` if the cell is empty.
         #[inline]
         pub fn get(&self) -> Option<&T> {
-            // Safe due to `inner`'s invariant
+            // Safe due to `inner`'s invariant of being written to at most once.
+            // Had multiple writes to `inner` been allowed, a reference to the
+            // value we return now would become dangling by a write of a
+            // different value later.
             unsafe { &*self.inner.get() }.as_ref()
         }