Skip to content

Commit

Permalink
Improve thread safety docs/bounds for PrimitiveMut
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 591047379
  • Loading branch information
kupiakos authored and copybara-github committed Dec 14, 2023
1 parent f51182b commit 8505082
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rust/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ impl<'msg, T> PrimitiveMut<'msg, T> {
}
}

// SAFETY: all `T` that can perform mutations don't mutate through a shared
// reference.
unsafe impl<'msg, T> Sync for PrimitiveMut<'msg, T> {}

impl<'msg, T> PrimitiveMut<'msg, T>
Expand Down
2 changes: 2 additions & 0 deletions rust/vtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@ pub trait PrimitiveWithRawVTable:
+ Debug
+ 'static
+ ProxiedWithPresence
+ Sync
+ Send
+ for<'msg> Proxied<View<'msg> = Self, Mut<'msg> = PrimitiveMut<'msg, Self>>
{
}
Expand Down

0 comments on commit 8505082

Please sign in to comment.