

Implement `Sync` for `mpsc::Sender` by ibraheemdev · Pull Request #111087 · rust...
source link: https://github.com/rust-lang/rust/pull/111087
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Conversation
Contributor
mpsc::Sender
is currently !Sync
because the previous implementation contained an optimization where the channel started out as single-producer and was dynamically upgraded on the first clone, which relied on a unique reference to the sender. This optimization is one of the main reasons the old implementation was so complex and was removed in #93563. mpsc::Sender
can now soundly implement Sync
.
Note for any potential confusion, this chance does not add MPMC behavior. This only affects the already Send + Clone
sender, not receiver.
It's technically possible to rely on the !Sync
behavior in the same way as a PhantomData<*mut T>
, but that seems very unlikely in practice. Either way, this change is insta-stable and needs an FCP.
@rustbot label +T-libs-api -T-libs
Collaborator
(rustbot has picked a reviewer for you, use r? to override) |
added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.
labels
Collaborator
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label
Contributor
Author
@rustbot label -T-libs |
removed the T-libs Relevant to the library team, which will review and decide on the PR/issue. label
This comment has been minimized.
Member
This PR makes @rfcbot fcp merge |
Team member @BurntSushi has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns: Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it.
labels
Member
Are we certain that the original reason for a @rfcbot concern why-not-sync |
Member
Right now there are some failing tests. We should check to make sure those themselves don't raise any other concerns. @rfcbot concern failing-tests |
Contributor
I dug up #11111 - which made senders (and other channel types)
I doubt that the decision was considered in-depth - my guess is that it was done just to keep options open for future implementation changes. But maybe @alexcrichton remembers ;) |
Contributor
Ah, I found #42397 as well which made |
Member
This isn't the right PR. Is it #93563? |
Contributor
Author
I guess the big question is why implement
|
This comment has been minimized.
Member
@rfcbot resolve failing-tests |
added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised.
and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
labels
|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
No reviews
None yet
No milestone
Successfully merging this pull request may close these issues.
None yet
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK