Skip to content

Commit

Permalink
Adding a safety note
Browse files Browse the repository at this point in the history
  • Loading branch information
recatek committed Feb 19, 2025
1 parent acbce58 commit 9238418
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/archetype/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,9 @@ seq!(N in 17..=32 {

pub struct DataPtr<T>(NonNull<MaybeUninit<T>>);

// SAFETY: There's no explicit interior mutability going on here -- this is similar to a Vec-type
// API for the data stored within, so the send- and sync-ness should be the same as T. This is
// similar to the nomicon's implementation of RawVec<T>, which also has these unsafe impls added.
unsafe impl<T> Send for DataPtr<T> where T: Send {}
unsafe impl<T> Sync for DataPtr<T> where T: Sync {}

Expand Down

0 comments on commit 9238418

Please sign in to comment.