Auto merge of #121133 - tmiasko:skip-coroutines, r=cjgillot
Skip coroutines in jump threading to avoid query cycles Fixes #121094
This commit is contained in:
commit
a4472498d7
@ -68,6 +68,12 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
|||||||
let def_id = body.source.def_id();
|
let def_id = body.source.def_id();
|
||||||
debug!(?def_id);
|
debug!(?def_id);
|
||||||
|
|
||||||
|
// Optimizing coroutines creates query cycles.
|
||||||
|
if tcx.is_coroutine(def_id) {
|
||||||
|
trace!("Skipped for coroutine {:?}", def_id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let param_env = tcx.param_env_reveal_all_normalized(def_id);
|
let param_env = tcx.param_env_reveal_all_normalized(def_id);
|
||||||
let map = Map::new(tcx, body, Some(MAX_PLACES));
|
let map = Map::new(tcx, body, Some(MAX_PLACES));
|
||||||
let loop_headers = loop_headers(body);
|
let loop_headers = loop_headers(body);
|
||||||
|
14
tests/ui/mir/mir_query_cycle.rs
Normal file
14
tests/ui/mir/mir_query_cycle.rs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// Regression test for #121094.
|
||||||
|
// build-pass
|
||||||
|
// compile-flags: -O --crate-type=lib
|
||||||
|
// edition: 2021
|
||||||
|
use std::{future::Future, pin::Pin};
|
||||||
|
|
||||||
|
pub async fn foo(count: u32) {
|
||||||
|
if count == 0 {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
let fut: Pin<Box<dyn Future<Output = ()>>> = Box::pin(foo(count - 1));
|
||||||
|
fut.await;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user