Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Send/Sync bounds to many generic concurrent types. #23954

Closed
wants to merge 1 commit into from

Conversation

huonw
Copy link
Member

@huonw huonw commented Apr 1, 2015

These types are purely designed for concurrent code, and, at the moment,
are restricted to be used in those situations. This solidifies that goal
by imposing a strict restriction on the generic types from the start,
i.e. in the definition itself.

This is the opposite to #23176 which relaxes the bounds entirely (it is
backwards compatible to switch to that more flexible approach).

Unfortunately the message-passing primitives in std (the return value
from a thread, and sync::mpsc) aren't great about how they work with
mutability and sharing, and so require hacky error-prone unsafe impls.
However, they are purely implementation details: the interface isn't
affected by having to make that internal change, and clean-ups to the
code should be able to remove the hacks.

These types are purely designed for concurrent code, and, at the moment,
are restricted to be used in those situations. This solidifies that goal
by imposing a strict restriction on the generic types from the start,
i.e. in the definition itself.

This is the opposite to rust-lang#23176 which relaxes the bounds entirely (it is
backwards compatible to switch to that more flexible approach).

Unfortunately the message-passing primitives in std (the return value
from a thread, and sync::mpsc) aren't great about how they work with
mutability and sharing, and so require hacky error-prone `unsafe impl`s.
However, they are purely implementation details: the interface isn't
affected by having to make that internal change, and clean-ups to the
code should be able to remove the hacks.
@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@huonw
Copy link
Member Author

huonw commented Apr 1, 2015

#23176 (comment)

@huonw huonw closed this Apr 1, 2015
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.

3 participants