-
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
Code no longer compiles after -Zdrop-tracking-mir was enabled by default #116242
Comments
I've made a minimized version of this using tokio which confirmed the behavior of passing on the stable compiler and failing to compile on nightly in the playground: use futures::pin_mut;
use futures::select;
use futures::FutureExt;
fn main() {
let rt = tokio::runtime::Runtime::new().unwrap();
let (send, recv) = futures::channel::oneshot::channel::<()>();
let ready_fut = futures::future::ready(());
pin_mut!(ready_fut, recv);
let combined_fut = async {
select! {
_ = recv => unreachable!("should not send"),
() = ready_fut => (),
}
};
pin_mut!(combined_fut);
let _ = rt.block_on(combined_fut);
send.send(()).unwrap();
assert_eq!(Some(Ok(())), recv.now_or_never());
} |
Thanks for the repro @jamuraa. What changed is the the dropping of I'm not sure how this can be fixed. |
Nominating for the next T-compiler meeting. I'd like to get a feeling of the priority and actionables. @rustbot label +I-compiler-nominated |
During the compiler team triage meeting, @jackh726 said:
so nominating for T-types as well. |
We discussed this in the @rust-lang/types meeting today. @lcnr is going to mentor @spastorino to prepare a fix by modifying the drop outlives code for generators to be more accurate. |
@rustbot assign @spastorino |
@rustbot labels +AsyncAwait-Triaged We discussed this in a WG-async meeting and are leaving this in the capable hands of T-types for resolution. |
dropck_outlives check whether generator witness needs_drop see https://rust-lang.zulipchat.com/#narrow/stream/326866-t-types.2Fnominated/topic/.23116242.3A.20Code.20no.20longer.20compiles.20after.20-Zdrop-tracking-mir.20.E2.80.A6/near/398311627 for an explanation. Fixes rust-lang#116242 (or well, the repro by `@jamuraa` in rust-lang#116242 (comment)). I did not add a regression test as it depends on other crates. We do have 1 test going from fail to pass, showing the intended behavior. r? types
dropck_outlives check whether generator witness needs_drop see https://rust-lang.zulipchat.com/#narrow/stream/326866-t-types.2Fnominated/topic/.23116242.3A.20Code.20no.20longer.20compiles.20after.20-Zdrop-tracking-mir.20.E2.80.A6/near/398311627 for an explanation. Fixes rust-lang#116242 (or well, the repro by `@jamuraa` in rust-lang#116242 (comment)). I did not add a regression test as it depends on other crates. We do have 1 test going from fail to pass, showing the intended behavior. r? types
Reduced use std::future;
fn main() {
let mut recv = future::ready(());
let _combined_fut = async {
let _ = || read(&mut recv);
};
drop(recv);
}
fn read<F: future::Future>(_: &mut F) -> F::Output {
todo!()
} You could likely inline |
Briefly mentioned this one during T-compiler meeting (Zulip notes). Leaving this as |
Reopening to track beta-backport. |
Removing the T-compiler nomination as the backport of #117134 was approved (Zulip link). @rustbot label -I-compiler-nominated |
I can confirm that the failing code now compiles on a recent rust build (revision d97bb19). |
Great, thank you! |
Some code that used to compile no longer does after #107421. We don't think was ever supposed to compile. Don't have an MCVE yet.
Snippet:
Full code is here: https://cs.opensource.google/fuchsia/fuchsia/+/main:src/connectivity/network/dhcpv4/client/core/src/client.rs;l=1521-1576;drc=4a7d2eb6793e61c0021f8dd7dab35804590d36b6
I expected to see this happen: compiles as before
Instead, this happened:
Version it worked on
It most recently worked on: Nightly 2023-09-22
@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged
The text was updated successfully, but these errors were encountered: