File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 11//! Public API facades for the implementation details of [`Zalsa`] and [`ZalsaLocal`].
22use std:: marker:: PhantomData ;
3- use std:: mem;
43use std:: panic:: RefUnwindSafe ;
54
65use crate :: database:: RawDatabase ;
@@ -158,9 +157,10 @@ impl<Db: Database> Storage<Db> {
158157
159158 let mut coordinate_lock = self . handle . coordinate . coordinate_lock . lock ( ) ;
160159 let zalsa = loop {
161- if let Some ( zalsa) = Arc :: get_mut ( & mut self . handle . zalsa_impl ) {
162- // SAFETY: Polonius when ... https://github.com/rust-lang/rfcs/blob/master/text/2094-nll.md#problem-case-3-conditional-control-flow-across-functions
163- break unsafe { mem:: transmute :: < & mut Zalsa , & mut Zalsa > ( zalsa) } ;
160+ if Arc :: strong_count ( & self . handle . zalsa_impl ) == 1 {
161+ // SAFETY: The strong count is 1, and we never create any weak pointers,
162+ // so we have a unique reference.
163+ break unsafe { & mut * ( Arc :: as_ptr ( & self . handle . zalsa_impl ) as * mut Zalsa ) } ;
164164 }
165165 coordinate_lock = self . handle . coordinate . cvar . wait ( coordinate_lock) ;
166166 } ;
You can’t perform that action at this time.
0 commit comments