From 0a6bd8f2c0a7c79d17f5dc9e64af0b4c6c745166 Mon Sep 17 00:00:00 2001 From: Mica White Date: Wed, 26 Aug 2026 21:03:22 -0400 Subject: Comments --- src/context/context.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/context/context.rs') diff --git a/src/context/context.rs b/src/context/context.rs index adc684f..80a1881 100644 --- a/src/context/context.rs +++ b/src/context/context.rs @@ -7,7 +7,9 @@ use crate::{ }; impl<'l, L> LockContext<'l, L> { - pub(crate) const fn new(lockable: &'l L) -> Self + /// Safety: Don't lock the locks in a different order than what the + /// LockContext uses + pub(crate) const unsafe fn new(lockable: &'l L) -> Self where L: OwnedLockable, { @@ -56,6 +58,8 @@ impl<'l, L> LockContext<'l, L> { /// ``` /// /// [`ContextGuard`]: `crate::context::ContextGuard` + // The mutable reference ensures that all of the guards, which have a shared + // borrow to the context, must be dropped first pub fn unlock(&mut self) -> Option { self.key.take() } -- cgit v1.3.1