Skip to content
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: by_move_body: impossible case reached #129676

Closed
matthiaskrgr opened this issue Aug 28, 2024 · 3 comments · Fixed by #129677
Closed

ICE: by_move_body: impossible case reached #129676

matthiaskrgr opened this issue Aug 28, 2024 · 3 comments · Fixed by #129677
Labels
C-bug Category: This is a bug. F-async_closure `#![feature(async_closure)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

async fn fun<'a>() {
    let _ = join_all((0..3).map(async |_| {})).await;
}

original:

#![feature(async_closure)]

use futures::future::join_all;

async fn fun<'a>(param: &'a u32) {
	let _ = join_all((0..3).map(async |_| {
		format!("{}", param)
	})).await;
}

fn main() {
	futures::executor::block_on(fun(&1));
}

Version information

rustc 1.82.0-nightly (d9a2cc4da 2024-08-27)
binary: rustc
commit-hash: d9a2cc4daee38c63b2f69710ed61d40acc32b709
commit-date: 2024-08-27
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zunstable-options --edition=2024

Program output

error[E0658]: async closures are unstable
 --> /tmp/icemaker_global_tempdir.qQOR5PdPVeKt/rustc_testrunner_tmpdir_reporting.ZhY387l6Z9MY/mvce.rs:2:33
  |
2 |     let _ = join_all((0..3).map(async |_| {})).await;
  |                                 ^^^^^
  |
  = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
  = help: add `#![feature(async_closure)]` to the crate attributes to enable
  = note: this compiler was built on 2024-08-27; consider upgrading it if it is out of date
  = help: to use an async block, remove the `||`: `async {`

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.qQOR5PdPVeKt/rustc_testrunner_tmpdir_reporting.ZhY387l6Z9MY/mvce.rs:3:2
  |
3 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.qQOR5PdPVeKt/rustc_testrunner_tmpdir_reporting.ZhY387l6Z9MY/mvce.rs`

error[E0425]: cannot find function `join_all` in this scope
 --> /tmp/icemaker_global_tempdir.qQOR5PdPVeKt/rustc_testrunner_tmpdir_reporting.ZhY387l6Z9MY/mvce.rs:2:13
  |
2 |     let _ = join_all((0..3).map(async |_| {})).await;
  |             ^^^^^^^^ not found in this scope

error: internal compiler error: compiler/rustc_mir_transform/src/coroutine/by_move_body.rs:110:9: impossible case reached

thread 'rustc' panicked at compiler/rustc_mir_transform/src/coroutine/by_move_body.rs:110:9:
Box<dyn Any>
stack backtrace:
   0:     0x796ab79ed14d - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h7363ce71779ec9c6
   1:     0x796ab8202c97 - core::fmt::write::h44e970cb9b26547f
   2:     0x796ab91cd111 - std::io::Write::write_fmt::h83cfd3c735df90d5
   3:     0x796ab79ef82b - std::panicking::default_hook::{{closure}}::h6f491270a33b28e9
   4:     0x796ab79ef49e - std::panicking::default_hook::h4093e14fa2c2927b
   5:     0x796ab6b502b9 - std[c988b194526ad436]::panicking::update_hook::<alloc[fb4a6b32a2001a3d]::boxed::Box<rustc_driver_impl[2a2e732cd68cd602]::install_ice_hook::{closure#0}>>::{closure#0}
   6:     0x796ab79f0147 - std::panicking::rust_panic_with_hook::h076b5468ef3279ca
   7:     0x796ab6b89dc1 - std[c988b194526ad436]::panicking::begin_panic::<rustc_errors[c6d202a4b3371a7f]::ExplicitBug>::{closure#0}
   8:     0x796ab6b7d486 - std[c988b194526ad436]::sys::backtrace::__rust_end_short_backtrace::<std[c988b194526ad436]::panicking::begin_panic<rustc_errors[c6d202a4b3371a7f]::ExplicitBug>::{closure#0}, !>
   9:     0x796ab6b7d206 - std[c988b194526ad436]::panicking::begin_panic::<rustc_errors[c6d202a4b3371a7f]::ExplicitBug>
  10:     0x796ab6b92fe1 - <rustc_errors[c6d202a4b3371a7f]::diagnostic::BugAbort as rustc_errors[c6d202a4b3371a7f]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x796ab715ad94 - rustc_middle[953b8dd86f89e09]::util::bug::opt_span_bug_fmt::<rustc_span[acd227fd1c8987f]::span_encoding::Span>::{closure#0}
  12:     0x796ab714094a - rustc_middle[953b8dd86f89e09]::ty::context::tls::with_opt::<rustc_middle[953b8dd86f89e09]::util::bug::opt_span_bug_fmt<rustc_span[acd227fd1c8987f]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:     0x796ab71407fb - rustc_middle[953b8dd86f89e09]::ty::context::tls::with_context_opt::<rustc_middle[953b8dd86f89e09]::ty::context::tls::with_opt<rustc_middle[953b8dd86f89e09]::util::bug::opt_span_bug_fmt<rustc_span[acd227fd1c8987f]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:     0x796ab4c1ade0 - rustc_middle[953b8dd86f89e09]::util::bug::bug_fmt
  15:     0x796ab72d008b - rustc_mir_transform[f8a23681d5b0e319]::coroutine::by_move_body::coroutine_by_move_body_def_id
  16:     0x796ab752a8bc - rustc_query_impl[a5edc71043c388ee]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a5edc71043c388ee]::query_impl::coroutine_by_move_body_def_id::dynamic_query::{closure#2}::{closure#0}, rustc_middle[953b8dd86f89e09]::query::erase::Erased<[u8; 8usize]>>
  17:     0x796ab822a66e - rustc_query_system[aca73356a4d1940b]::query::plumbing::try_execute_query::<rustc_query_impl[a5edc71043c388ee]::DynamicConfig<rustc_query_system[aca73356a4d1940b]::query::caches::DefIdCache<rustc_middle[953b8dd86f89e09]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a5edc71043c388ee]::plumbing::QueryCtxt, false>
  18:     0x796ab753861e - rustc_query_impl[a5edc71043c388ee]::query_impl::coroutine_by_move_body_def_id::get_query_non_incr::__rust_end_short_backtrace
  19:     0x796ab88d6817 - rustc_interface[acf51b738136240b]::passes::run_required_analyses
  20:     0x796ab8fe879e - rustc_interface[acf51b738136240b]::passes::analysis
  21:     0x796ab8fe8771 - rustc_query_impl[a5edc71043c388ee]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a5edc71043c388ee]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[953b8dd86f89e09]::query::erase::Erased<[u8; 1usize]>>
  22:     0x796ab91702ae - rustc_query_system[aca73356a4d1940b]::query::plumbing::try_execute_query::<rustc_query_impl[a5edc71043c388ee]::DynamicConfig<rustc_query_system[aca73356a4d1940b]::query::caches::SingleCache<rustc_middle[953b8dd86f89e09]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[a5edc71043c388ee]::plumbing::QueryCtxt, false>
  23:     0x796ab917000f - rustc_query_impl[a5edc71043c388ee]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  24:     0x796ab8fd6eec - rustc_interface[acf51b738136240b]::interface::run_compiler::<core[1ab42d1e62fda574]::result::Result<(), rustc_span[acd227fd1c8987f]::ErrorGuaranteed>, rustc_driver_impl[2a2e732cd68cd602]::run_compiler::{closure#0}>::{closure#1}
  25:     0x796ab907ca50 - std[c988b194526ad436]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[acf51b738136240b]::util::run_in_thread_with_globals<rustc_interface[acf51b738136240b]::util::run_in_thread_pool_with_globals<rustc_interface[acf51b738136240b]::interface::run_compiler<core[1ab42d1e62fda574]::result::Result<(), rustc_span[acd227fd1c8987f]::ErrorGuaranteed>, rustc_driver_impl[2a2e732cd68cd602]::run_compiler::{closure#0}>::{closure#1}, core[1ab42d1e62fda574]::result::Result<(), rustc_span[acd227fd1c8987f]::ErrorGuaranteed>>::{closure#0}, core[1ab42d1e62fda574]::result::Result<(), rustc_span[acd227fd1c8987f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1ab42d1e62fda574]::result::Result<(), rustc_span[acd227fd1c8987f]::ErrorGuaranteed>>
  26:     0x796ab907d0ba - <<std[c988b194526ad436]::thread::Builder>::spawn_unchecked_<rustc_interface[acf51b738136240b]::util::run_in_thread_with_globals<rustc_interface[acf51b738136240b]::util::run_in_thread_pool_with_globals<rustc_interface[acf51b738136240b]::interface::run_compiler<core[1ab42d1e62fda574]::result::Result<(), rustc_span[acd227fd1c8987f]::ErrorGuaranteed>, rustc_driver_impl[2a2e732cd68cd602]::run_compiler::{closure#0}>::{closure#1}, core[1ab42d1e62fda574]::result::Result<(), rustc_span[acd227fd1c8987f]::ErrorGuaranteed>>::{closure#0}, core[1ab42d1e62fda574]::result::Result<(), rustc_span[acd227fd1c8987f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1ab42d1e62fda574]::result::Result<(), rustc_span[acd227fd1c8987f]::ErrorGuaranteed>>::{closure#1} as core[1ab42d1e62fda574]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  27:     0x796ab907d42b - std::sys::pal::unix::thread::Thread::new::thread_start::h5546d7ef64313a46
  28:     0x796aba6e039d - <unknown>
  29:     0x796aba76549c - <unknown>
  30:                0x0 - <unknown>

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.82.0-nightly (d9a2cc4da 2024-08-27) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options -Z dump-mir-dir=dir

query stack during panic:
#0 [coroutine_by_move_body_def_id] looking up the coroutine by-move body for `fun::{closure#0}::{closure#0}::{closure#0}`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors

Some errors have detailed explanations: E0425, E0601, E0658.
For more information about an error, try `rustc --explain E0425`.

@rustbot label +F-async_closure

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Aug 28, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-async_closure `#![feature(async_closure)]` labels Aug 28, 2024
@compiler-errors
Copy link
Member

@matthiaskrgr: As a step of reducing your code examples, could you please ensure that --edition 2024 -Zunstable-options is necessary to reproduce this ICE before mentioning it in the issue? This ICE reproduces on edition 2021, which is the current stable edition.

@humb1t
Copy link

humb1t commented Aug 29, 2024

My project fails on nightly also while using edition 2021.

error: internal compiler error: compiler/rustc_middle/src/query/plumbing.rs:663:5: `tcx.coroutine_by_move_body_def_id(DefId(390:51 ~ async_graphql_axum_toolkit[3e8c]::handlers::graphql_ws_handler::{closure#0}::{closure#0}::{closure#0}))` unsupported by its crate; perhaps the `coroutine_by_move_body_def_id` query was never assigned a provider function

thread 'rustc' panicked at compiler/rustc_middle/src/query/plumbing.rs:663:5:
Box<dyn Any>
stack backtrace:
   0:        0x10f42e61c - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hfc9cad5c5448359b
   1:        0x10c8865e0 - core::fmt::write::h6102c5cb7bbbc5d3
   2:        0x10f422640 - std::io::Write::write_fmt::hfe3a0095160301d1
   3:        0x10f430cf4 - std::panicking::default_hook::{{closure}}::hde8312774faee49d
   4:        0x10f430948 - std::panicking::default_hook::hcdc1900101ae985b
   5:        0x10d449320 - <alloc[7ab01d74231c252f]::boxed::Box<rustc_driver_impl[8dfa8c7898e0dea6]::install_ice_hook::{closure#0}> as core[53c9be09e83560e3]::ops::function::Fn<(&dyn for<'a, 'b> core[53c9be09e83560e3]::ops::function::Fn<(&'a std[9c1b55c92f8e8d6a]::panic::PanicHookInfo<'b>,), Output = ()> + core[53c9be09e83560e3]::marker::Send + core[53c9be09e83560e3]::marker::Sync, &std[9c1b55c92f8e8d6a]::panic::PanicHookInfo)>>::call

@compiler-errors
Copy link
Member

@humb1t: Yep, a fix is already up and it's waiting for approval. I recommend downgrading to a slightly older nightly until this is fixed.

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 29, 2024
@bors bors closed this as completed in 37523d2 Sep 8, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Sep 8, 2024
Rollup merge of rust-lang#129677 - compiler-errors:by-move-body-err, r=cjgillot

Don't build by-move body when async closure is tainted

Fixes rust-lang#129676

See explanation in the ui test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-async_closure `#![feature(async_closure)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants