-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Ensure the coordinator thread terminates before its channels drop #145894
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
Conversation
rustbot has assigned @petrochenkov. Use |
Some changes occurred in compiler/rustc_codegen_ssa |
r? WaffleLapkin |
pub codegen_worker_receive: Receiver<CguMessage>, | ||
pub shared_emitter_main: SharedEmitterMain, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment saying the field order is intentional would be helpful for future readers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Field order below is intended to terminate the coordinator thread before two fields below drop and prematurely close channels used by coordinator thread. See
Coordinator
'sDrop
implementation for more info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually implementing Drop
is also common when a specific drop order is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe wrap intended fields in some comment block? This way new added fields to this struct didn't mix up with this description. Or maybe better impl drop for OngoingCodegen to enforce drop order, instead of comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@klensy I think the current state is alright, but feel free to open a follow-up to make things nicer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually implementing
Drop
is also common when a specific drop order is required.
I think better place for moved fields then would be inside of Coordinator
. Idk, maybe i should do that instead? That would probably be more manageable.
@bors r- |
Alright, I have reproduced the issue and confirmed my hypothesis. This PR should fix it. |
@bors r+ rollup |
Rollup of 5 pull requests Successful merges: - #145382 (Add assembly test for `-Zreg-struct-return` option) - #145746 (Fix STD build failing for target_os = "espidf") - #145826 (Use AcceptContext in AttribueParser::check_target) - #145894 (Ensure the coordinator thread terminates before its channels drop) - #145946 (Remove unnecessary `[dependencies.unicode-properties]` entries.) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #145894 - zetanumbers:issue-142949, r=WaffleLapkin Ensure the coordinator thread terminates before its channels drop Fixes #142949 Explanation: #142949 (comment)
Fixes #142949
Explanation: #142949 (comment)