Skip to content
Snippets Groups Projects
Commit f75561b7 authored by Lyude Paul's avatar Lyude Paul
Browse files

WIP: rust: lock: Add B::is_locked() assertion to Guard::new()

TODO: turn this into its own commit in preparation for making Guard::new()
public
parent 6a7f920d
No related merge requests found
...@@ -252,6 +252,9 @@ impl<'a, T: ?Sized, B: Backend> Guard<'a, T, B> { ...@@ -252,6 +252,9 @@ impl<'a, T: ?Sized, B: Backend> Guard<'a, T, B> {
state: B::GuardState, state: B::GuardState,
_context: B::Context<'a>, _context: B::Context<'a>,
) -> Self { ) -> Self {
// SAFETY: The lock is guaranteed to be initialized by `Lock`'s type invariants
debug_assert!(unsafe { B::is_locked(lock.state.get()) });
Self { Self {
lock, lock,
state, state,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment