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: unexpected coroutine type Pin<&mut.. #117670

Closed
matthiaskrgr opened this issue Nov 7, 2023 · 1 comment · Fixed by #117686
Closed

ice: unexpected coroutine type Pin<&mut.. #117670

matthiaskrgr opened this issue Nov 7, 2023 · 1 comment · Fixed by #117686
Assignees
Labels
C-bug Category: This is a bug. 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

snippet:

async fn asyncfn() {
    let binding = match true {};
}

Version information

rustc 1.75.0-nightly (61a3eea80 2023-11-07)
binary: rustc
commit-hash: 61a3eea8043cc1c7a09c2adda884e27ffa8a1172
commit-date: 2023-11-07
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.4

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0670]: `async fn` is not permitted in Rust 2015
 --> /tmp/icemaker_global_tempdir.7o3Q1gw7UiZR/rustc_testrunner_tmpdir_reporting.9ubqj5lFq7ji/mvce.rs:1:1
  |
1 | async fn asyncfn() {
  | ^^^^^ to use `async fn`, switch to Rust 2018 or later
  |
  = help: pass `--edition 2021` to `rustc`
  = note: for more on editions, read https://doc.rust-lang.org/edition-guide

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

error[E0004]: non-exhaustive patterns: type `bool` is non-empty
 --> /tmp/icemaker_global_tempdir.7o3Q1gw7UiZR/rustc_testrunner_tmpdir_reporting.9ubqj5lFq7ji/mvce.rs:2:25
  |
2 |     let binding = match true {};
  |                         ^^^^
  |
  = note: the matched value is of type `bool`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
  |
2 ~     let binding = match true {
3 +         _ => todo!(),
4 ~     };
  |

error: internal compiler error: compiler/rustc_mir_transform/src/coroutine.rs:1456:14: unexpected coroutine type Pin<&mut {async fn body@/tmp/icemaker_global_tempdir.7o3Q1gw7UiZR/rustc_testrunner_tmpdir_reporting.9ubqj5lFq7ji/mvce.rs:1:20: 3:2}>
 --> /tmp/icemaker_global_tempdir.7o3Q1gw7UiZR/rustc_testrunner_tmpdir_reporting.9ubqj5lFq7ji/mvce.rs:1:20
  |
1 |   async fn asyncfn() {
  |  ____________________^
2 | |     let binding = match true {};
3 | | }
  | |_^

thread 'rustc' panicked at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/compiler/rustc_errors/src/lib.rs:1000:33:
Box<dyn Any>
stack backtrace:
   0:     0x7f9895169cfc - std::backtrace_rs::backtrace::libunwind::trace::ha8f6e52a8cecff6b
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f9895169cfc - std::backtrace_rs::backtrace::trace_unsynchronized::hc3d43a7a80e1a3c8
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9895169cfc - std::sys_common::backtrace::_print_fmt::hc7440be187a95d41
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f9895169cfc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h96cf8ee4b5f2e036
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f98951cbf20 - core::fmt::rt::Argument::fmt::hdfd5a66e0fbbda61
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/core/src/fmt/rt.rs:142:9
   5:     0x7f98951cbf20 - core::fmt::write::hbf8504e4604fab75
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/core/src/fmt/mod.rs:1117:17
   6:     0x7f989515dc1f - std::io::Write::write_fmt::h8c1794a4e8f00a67
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/std/src/io/mod.rs:1763:15
   7:     0x7f9895169ae4 - std::sys_common::backtrace::_print::h8fc37d1a8fd62fb9
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f9895169ae4 - std::sys_common::backtrace::print::h6ea2abbcb6744317
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f989516c777 - std::panicking::default_hook::{{closure}}::h264888a1ebdc1f1f
  10:     0x7f989516c4df - std::panicking::default_hook::h7cd70883366c02e2
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/std/src/panicking.rs:292:9
  11:     0x7f9897eabd60 - std[a7c0a148e67fdc04]::panicking::update_hook::<alloc[4f836f92b421e5d]::boxed::Box<rustc_driver_impl[8f58a3fefd4a7177]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f989516ceb8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hae96e9a73f1815a9
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/alloc/src/boxed.rs:2021:9
  13:     0x7f989516ceb8 - std::panicking::rust_panic_with_hook::h3b7bf215b6d504aa
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/std/src/panicking.rs:783:13
  14:     0x7f98984798d4 - std[a7c0a148e67fdc04]::panicking::begin_panic::<rustc_errors[ff5223dc5e19fc25]::ExplicitBug>::{closure#0}
  15:     0x7f989846f576 - std[a7c0a148e67fdc04]::sys_common::backtrace::__rust_end_short_backtrace::<std[a7c0a148e67fdc04]::panicking::begin_panic<rustc_errors[ff5223dc5e19fc25]::ExplicitBug>::{closure#0}, !>
  16:     0x7f989845e6e6 - std[a7c0a148e67fdc04]::panicking::begin_panic::<rustc_errors[ff5223dc5e19fc25]::ExplicitBug>
  17:     0x7f989845086e - <rustc_errors[ff5223dc5e19fc25]::HandlerInner>::span_bug::<rustc_span[4568d02bda951cb5]::span_encoding::Span, alloc[4f836f92b421e5d]::string::String>
  18:     0x7f9898445478 - <rustc_errors[ff5223dc5e19fc25]::Handler>::span_bug::<rustc_span[4568d02bda951cb5]::span_encoding::Span, alloc[4f836f92b421e5d]::string::String>
  19:     0x7f9898479a1b - rustc_middle[5cc2d7af9b9bf8d9]::util::bug::opt_span_bug_fmt::<rustc_span[4568d02bda951cb5]::span_encoding::Span>::{closure#0}
  20:     0x7f9898479a4a - rustc_middle[5cc2d7af9b9bf8d9]::ty::context::tls::with_opt::<rustc_middle[5cc2d7af9b9bf8d9]::util::bug::opt_span_bug_fmt<rustc_span[4568d02bda951cb5]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f989846f5b8 - rustc_middle[5cc2d7af9b9bf8d9]::ty::context::tls::with_context_opt::<rustc_middle[5cc2d7af9b9bf8d9]::ty::context::tls::with_opt<rustc_middle[5cc2d7af9b9bf8d9]::util::bug::opt_span_bug_fmt<rustc_span[4568d02bda951cb5]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f9896f0e7e4 - rustc_middle[5cc2d7af9b9bf8d9]::util::bug::span_bug_fmt::<rustc_span[4568d02bda951cb5]::span_encoding::Span>
  23:     0x7f9898508de2 - rustc_mir_transform[2f4f7bcc12e314b4]::coroutine::mir_coroutine_witnesses
  24:     0x7f9898689e4c - rustc_query_impl[640096e6498a15f6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[640096e6498a15f6]::query_impl::mir_coroutine_witnesses::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5cc2d7af9b9bf8d9]::query::erase::Erased<[u8; 8usize]>>
  25:     0x7f98990830d8 - rustc_query_system[d79ebc7ab414f88c]::query::plumbing::try_execute_query::<rustc_query_impl[640096e6498a15f6]::DynamicConfig<rustc_query_system[d79ebc7ab414f88c]::query::caches::DefaultCache<rustc_span[4568d02bda951cb5]::def_id::DefId, rustc_middle[5cc2d7af9b9bf8d9]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[640096e6498a15f6]::plumbing::QueryCtxt, false>
  26:     0x7f989868ffd8 - rustc_query_impl[640096e6498a15f6]::query_impl::mir_coroutine_witnesses::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7f989919c905 - rustc_middle[5cc2d7af9b9bf8d9]::query::plumbing::query_get_at::<rustc_query_system[d79ebc7ab414f88c]::query::caches::DefaultCache<rustc_span[4568d02bda951cb5]::def_id::DefId, rustc_middle[5cc2d7af9b9bf8d9]::query::erase::Erased<[u8; 8usize]>>>
  28:     0x7f989a59fa3d - <rustc_middle[5cc2d7af9b9bf8d9]::ty::util::OpaqueTypeExpander as rustc_type_ir[80d8ecad5527dc5b]::fold::TypeFolder<rustc_middle[5cc2d7af9b9bf8d9]::ty::context::TyCtxt>>::fold_ty.cold.0
  29:     0x7f9899aa5dde - <&rustc_middle[5cc2d7af9b9bf8d9]::ty::list::List<rustc_middle[5cc2d7af9b9bf8d9]::ty::generic_args::GenericArg> as rustc_type_ir[80d8ecad5527dc5b]::fold::TypeFoldable<rustc_middle[5cc2d7af9b9bf8d9]::ty::context::TyCtxt>>::try_fold_with::<rustc_middle[5cc2d7af9b9bf8d9]::ty::util::OpaqueTypeExpander>
  30:     0x7f989a59fc33 - <rustc_middle[5cc2d7af9b9bf8d9]::ty::util::OpaqueTypeExpander as rustc_type_ir[80d8ecad5527dc5b]::fold::TypeFolder<rustc_middle[5cc2d7af9b9bf8d9]::ty::context::TyCtxt>>::fold_ty.cold.0
  31:     0x7f9899aa659f - <rustc_middle[5cc2d7af9b9bf8d9]::ty::util::OpaqueTypeExpander>::expand_opaque_ty
  32:     0x7f9899aa62d8 - <rustc_middle[5cc2d7af9b9bf8d9]::ty::context::TyCtxt>::try_expand_impl_trait_type
  33:     0x7f98995884d6 - rustc_hir_analysis[ce52d48230ee7ff2]::check::check::check_mod_item_types
  34:     0x7f9899586eb9 - rustc_query_impl[640096e6498a15f6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[640096e6498a15f6]::query_impl::check_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5cc2d7af9b9bf8d9]::query::erase::Erased<[u8; 0usize]>>
  35:     0x7f98999e3a3b - rustc_query_system[d79ebc7ab414f88c]::query::plumbing::try_execute_query::<rustc_query_impl[640096e6498a15f6]::DynamicConfig<rustc_query_system[d79ebc7ab414f88c]::query::caches::DefaultCache<rustc_span[4568d02bda951cb5]::def_id::LocalModDefId, rustc_middle[5cc2d7af9b9bf8d9]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[640096e6498a15f6]::plumbing::QueryCtxt, false>
  36:     0x7f98999e3417 - rustc_query_impl[640096e6498a15f6]::query_impl::check_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7f989961b059 - rustc_hir_analysis[ce52d48230ee7ff2]::check_crate
  38:     0x7f98992a31d5 - rustc_interface[9052e2cdd752e6f7]::passes::analysis
  39:     0x7f98992a2e1d - rustc_query_impl[640096e6498a15f6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[640096e6498a15f6]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5cc2d7af9b9bf8d9]::query::erase::Erased<[u8; 1usize]>>
  40:     0x7f9899ca7800 - rustc_query_system[d79ebc7ab414f88c]::query::plumbing::try_execute_query::<rustc_query_impl[640096e6498a15f6]::DynamicConfig<rustc_query_system[d79ebc7ab414f88c]::query::caches::SingleCache<rustc_middle[5cc2d7af9b9bf8d9]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[640096e6498a15f6]::plumbing::QueryCtxt, false>
  41:     0x7f9899ca7607 - rustc_query_impl[640096e6498a15f6]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7f9899fc0f33 - rustc_interface[9052e2cdd752e6f7]::interface::run_compiler::<core[9831b5d2acfe63fe]::result::Result<(), rustc_span[4568d02bda951cb5]::ErrorGuaranteed>, rustc_driver_impl[8f58a3fefd4a7177]::run_compiler::{closure#1}>::{closure#0}
  43:     0x7f9899fee8ca - std[a7c0a148e67fdc04]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[9052e2cdd752e6f7]::util::run_in_thread_with_globals<rustc_interface[9052e2cdd752e6f7]::util::run_in_thread_pool_with_globals<rustc_interface[9052e2cdd752e6f7]::interface::run_compiler<core[9831b5d2acfe63fe]::result::Result<(), rustc_span[4568d02bda951cb5]::ErrorGuaranteed>, rustc_driver_impl[8f58a3fefd4a7177]::run_compiler::{closure#1}>::{closure#0}, core[9831b5d2acfe63fe]::result::Result<(), rustc_span[4568d02bda951cb5]::ErrorGuaranteed>>::{closure#0}, core[9831b5d2acfe63fe]::result::Result<(), rustc_span[4568d02bda951cb5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9831b5d2acfe63fe]::result::Result<(), rustc_span[4568d02bda951cb5]::ErrorGuaranteed>>
  44:     0x7f9899fee6f3 - <<std[a7c0a148e67fdc04]::thread::Builder>::spawn_unchecked_<rustc_interface[9052e2cdd752e6f7]::util::run_in_thread_with_globals<rustc_interface[9052e2cdd752e6f7]::util::run_in_thread_pool_with_globals<rustc_interface[9052e2cdd752e6f7]::interface::run_compiler<core[9831b5d2acfe63fe]::result::Result<(), rustc_span[4568d02bda951cb5]::ErrorGuaranteed>, rustc_driver_impl[8f58a3fefd4a7177]::run_compiler::{closure#1}>::{closure#0}, core[9831b5d2acfe63fe]::result::Result<(), rustc_span[4568d02bda951cb5]::ErrorGuaranteed>>::{closure#0}, core[9831b5d2acfe63fe]::result::Result<(), rustc_span[4568d02bda951cb5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9831b5d2acfe63fe]::result::Result<(), rustc_span[4568d02bda951cb5]::ErrorGuaranteed>>::{closure#1} as core[9831b5d2acfe63fe]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x7f9895177c25 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hbd3ecd0399f32c83
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/alloc/src/boxed.rs:2007:9
  46:     0x7f9895177c25 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::heae77eec81d79ab4
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/alloc/src/boxed.rs:2007:9
  47:     0x7f9895177c25 - std::sys::unix::thread::Thread::new::thread_start::h6bd8f7ef76843338
                               at /rustc/61a3eea8043cc1c7a09c2adda884e27ffa8a1172/library/std/src/sys/unix/thread.rs:108:17
  48:     0x7f9894f0c9eb - <unknown>
  49:     0x7f9894f907cc - <unknown>
  50:                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: rustc 1.75.0-nightly (61a3eea80 2023-11-07) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_coroutine_witnesses] coroutine witness types for `asyncfn::{closure#0}`
#1 [check_mod_item_types] checking item types in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors

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

@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 Nov 7, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 7, 2023
@matthiaskrgr
Copy link
Member Author

regression in #117418 ping @compiler-errors

@compiler-errors compiler-errors self-assigned this Nov 7, 2023
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 7, 2023
@bors bors closed this as completed in d2cdf6c Nov 15, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Nov 15, 2023
Rollup merge of rust-lang#117686 - compiler-errors:gen-body, r=wesleywiser

Build pre-coroutine-transform coroutine body on error

I was accidentally building the post-transform coroutine body, rather than the pre-transform coroutine body. There's no pinning expected here yet, and the return type isn't yet transformed into `CoroutineState`.

Fixes rust-lang#117670
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. 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.

4 participants