Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
run: rustup toolchain install nightly --component miri && rustup default nightly
- run: cargo miri test
env:
MIRIFLAGS: -Zmiri-disable-isolation
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-tag-raw-pointers

security_audit:
runs-on: ubuntu-latest
Expand Down
11 changes: 7 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl Event {
let inner = self.inner();
let listener = EventListener {
inner: unsafe { Arc::clone(&ManuallyDrop::new(Arc::from_raw(inner))) },
entry: Some(inner.lock().insert(inner.cache_ptr())),
entry: unsafe { Some((*inner).lock().insert((*inner).cache_ptr())) },
};

// Make sure the listener is registered before whatever happens next.
Expand Down Expand Up @@ -365,8 +365,11 @@ impl Event {
unsafe { inner.as_ref() }
}

/// Returns a reference to the inner state, initializing it if necessary.
fn inner(&self) -> &Inner {
/// Returns a raw pointer to the inner state, initializing it if necessary.
///
/// This returns a raw pointer instead of reference because `from_raw`
/// requires raw/mut provenance: <https://github.com/rust-lang/rust/pull/67339>
fn inner(&self) -> *const Inner {
let mut inner = self.inner.load(Ordering::Acquire);

// Initialize the state if this is its first use.
Expand Down Expand Up @@ -410,7 +413,7 @@ impl Event {
}
}

unsafe { &*inner }
inner
}
}

Expand Down