-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
ICE: Broken MIR in generators #61579
Comments
We don't generate |
In case if it will be useful, I caught similar ICE with a different callstack https://gist.github.com/DoumanAsh/2ce9e8aa6c360f5d74bdd169188fec8d But I imagine it is the same issue. Code in question: https://gitlab.com/Douman/yukikaze/blob/1.0/src/client/mod.rs#L216-317 |
@tmandry Did you see any reason for why |
For anyone hitting this issue looking (like me) for a workaround, assigning the value to a local variable works: pub async fn foo() {
let _ = std::thread::spawn(move || ());
bar().await;
} |
A variant that also ICEs (playground): #![feature(async_await)]
#[derive(Default)]
struct Foo {
}
impl Drop for Foo {
fn drop(&mut self) { }
}
async fn bar() {
}
pub async fn foo() {
Foo::default();
bar().await;
} seems like the problem is "dropping" a value that needs drop from a call |
Looking over our MIR construction code there seems to be lots of locals which do not generate a |
Sorry I missed your earlier comment @Zoxc, there are locals that we never generate any StorageLive/Dead statements for, and we have to handle these explicitly in the generator code as "storage ignored" locals. I don't know why we omit these, and for some reason thought it was only for "simple" types (I'm surprised to learn that we also do this for locals which are |
This does not appear to be a regression, but maybe there's some other problem afflicting 2019-05-03:
|
@nikomatsakis I'm seeing a regression between 2019-06-05 and 2019-06-06, so I think there was indeed another problem with your start point. This is probably due to the @Zoxc mentioned above; I also describe it here: #61731 (comment) |
I'm all ears for a model that makes this happen. However, I don't think we should have UB without having a clear idea of how to operationally check for it. And even then we still have to weigh the complexity of the model (that every unsafe code author will have to basically know by heart!) against the alternatives (such as emitting |
…sakis Clean up MIR drop generation * Don't assign twice to the destination of a `while` loop containing a `break` expression * Use `as_temp` to evaluate statement expression * Avoid consecutive `StorageLive`s for the condition of a `while` loop * Unify `return`, `break` and `continue` handling, and move it to `scopes.rs` * Make some of the `scopes.rs` internals private * Don't use `Place`s that are always `Local`s in MIR drop generation Closes #42371 Closes #61579 Closes #61731 Closes #61834 Closes #61910 Closes #62115
(playground), error:
This is minimized from failing doc-tests in
futures
(rust-lang/futures-rs#1657), from the CI builds there it appears the ICE was introduced betweenrustc 1.37.0-nightly (5d8f59f4b 2019-06-04)
andrustc 1.37.0-nightly (7cdaffd79 2019-06-05)
.The text was updated successfully, but these errors were encountered: