-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Drop all messages in bounded channel when destroying the last receiver #108164
Conversation
Tests that messages are immediately dropped once the last receiver is destroyed.
(rustbot has picked a reviewer for you, use r? to override) |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
r? @Amanieu Should this also be replicated in a PR to crossbeam? |
That'll be much appreciated because my pr (crossbeam-rs/crossbeam#959) at crossbeam will be based on this when extending my change to the |
LGTM but I'd like a second opinion from @ibraheemdev or @taiki-e. |
968: channel: Extend panic_on_drop test r=taiki-e a=taiki-e Include rust-lang/rust#107466 's case. cc rust-lang/rust#108164 Co-authored-by: Taiki Endo <te316e89@gmail.com>
@bors r+ |
…, r=Amanieu Drop all messages in bounded channel when destroying the last receiver Fixes rust-lang#107466 by splitting the `disconnect` function for receivers/transmitters and dropping all messages in `disconnect_receivers` like the unbounded channel does. Since all receivers must be dropped before the channel is, the messages will already be discarded at that point, so the `Drop` implementation for the channel can be removed. `@rustbot` label +T-libs +A-concurrency
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#96391 (Windows: make `Command` prefer non-verbatim paths) - rust-lang#108164 (Drop all messages in bounded channel when destroying the last receiver) - rust-lang#108729 (fix: modify the condition that `resolve_imports` stops) - rust-lang#109336 (Constrain const vars to error if const types are mismatched) - rust-lang#109403 (Avoid ICE of attempt to add with overflow in emitter) - rust-lang#109415 (Refactor `handle_missing_lit`.) - rust-lang#109441 (Only implement Fn* traits for extern "Rust" safe function pointers and items) - rust-lang#109446 (Do not suggest bounds restrictions for synthesized RPITITs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
(I wonder when this patch is upstreamed to the crossbeam repo...? is there some place for me to check the progress? context: i just want my crossbeam-rs/crossbeam#959 to move forward) |
Fixes #107466 by splitting the
disconnect
function for receivers/transmitters and dropping all messages indisconnect_receivers
like the unbounded channel does. Since all receivers must be dropped before the channel is, the messages will already be discarded at that point, so theDrop
implementation for the channel can be removed.@rustbot label +T-libs +A-concurrency