Skip to content

Conversation

@197g
Copy link
Contributor

@197g 197g commented Jan 4, 2026

Closes: #1001

Note that this is a breaking change. The precondition differs between ViewStorage and ViewStorageMut just like they differ between &mut T and & T. While both allow reborrowing a &T from a shared reference to them, i.e. they have the same requirements for their Sync implementations, the formalism is different for the Send trait:

  • a unique reference makes the value itself available and its creation and lifetime requires synchronization itself, hence Send where T: Send.
  • a shared reference does not imply any synchronization point in its creation or during its lifetime so we must only make it available to parallel use (sendable to other threads) if the underlying type handles that parallelism, hence Send where T: Sync.

See: https://doc.rust-lang.org/stable/std/primitive.reference.html#trait-implementations-1

Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I won't merge this personally so it doesn't catch @sebcrozet by surprise, but we should definitely take this for the next breaking release.

@sebcrozet sebcrozet merged commit 3014264 into dimforge:main Jan 4, 2026
13 checks passed
@sebcrozet
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unsound Send implementation for SliceStorage

3 participants