Skip to content

Commit

Permalink
review: add comment explaining impl Send/Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
abrown committed Jan 3, 2023
1 parent 23a6370 commit f3c4c51
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/wiggle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,9 @@ pub struct UnsafeGuestSlice<'a, T> {
mem: &'a dyn GuestMemory,
}

// SAFETY: `UnsafeGuestSlice` can be used across an `await` and therefore must
// be `Send` and `Sync`. As with `GuestSlice` and friends, we mirror the
// `Send`/`Sync` impls due to the interior usage of `&[UnsafeCell<T>]`.
unsafe impl<T: Sync> Sync for UnsafeGuestSlice<'_, T> {}
unsafe impl<T: Send> Send for UnsafeGuestSlice<'_, T> {}

Expand Down

0 comments on commit f3c4c51

Please sign in to comment.