Skip to content

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

Closed
huonw wants to merge 1 commit into
rust-lang:masterfrom
huonw:stricter-bounds
Closed

huonw wants to merge 1 commit into
rust-lang:masterfrom
huonw:stricter-bounds

Conversation

@huonw

@huonw huonw commented Apr 1, 2015

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

r? @alexcrichton

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

@huonw

huonw commented Apr 1, 2015

Copy link
Copy Markdown
Contributor Author

#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