-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Replace thread_local with generator resume arguments in box_region. #70622
Conversation
This is a plain replacement. @jonas-schievink, did you have something more comprehensive in mind? |
Seems like a good start, but to be honest, I have no idea what this code is supposed to do (other than that it can now use resume arguments to do it). r? @Zoxc |
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit aa92d26 with merge eeebed0947b040d9b65683d52071a94d926a398b... |
rust/src/librustc_interface/passes.rs Lines 88 to 92 in 75ff311
|
☀️ Try build successful - checks-azure |
Queued eeebed0947b040d9b65683d52071a94d926a398b with parent 99009bf, future comparison URL. |
Finished benchmarking try commit eeebed0947b040d9b65683d52071a94d926a398b, comparison URL. |
Btw there was a discussion that resume arguments can allow to get rid of unsafety in this module. let mut gen = Box::pin(static move |mut arg: &mut i32| {
loop {
*arg += 1;
arg = yield;
}
});
let mut a = 1;
Pin::new(&mut gen).resume(&mut a); Currently it doesn't compile. I'm not sure if I'm doing something wrong or it's just not supported yet. |
Since you are working on this, could you perhaps add some docs explaining what the "box region" does and why is it necessary? Right now it's entirely unclear. |
I'll try. |
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.
Okay, looks basically good to me @gizmondo!
If you want to add some more comments to this module, feel free. Otherwise r=me with the more detailed panic message below.
}; | ||
} | ||
$crate::box_region::Action::Complete => break, | ||
$crate::box_region::Action::Initial => panic!(), |
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.
$crate::box_region::Action::Initial => panic!(), | |
$crate::box_region::Action::Initial => bug!("unexpected box_region action: {:?}", $action), |
Ping from Triage: Closed due to inactivity. Please re-open with updates. Thanks for the PR! @gizmondo |
Replace thread_local with generator resume arguments in box_region. Fixes rust-lang#68922. Continuation of rust-lang#70622. Added a short doc, hope it makes sense. r? @jonas-schievink
Replace thread_local with generator resume arguments in box_region. Fixes rust-lang#68922. Continuation of rust-lang#70622. Added a short doc, hope it makes sense. r? @jonas-schievink
Fixes #68922.
r? @ghost