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 generator type [type error] #111468

Closed
matthiaskrgr opened this issue May 11, 2023 · 2 comments · Fixed by #111533
Closed

ICE: unexpected generator type [type error] #111468

matthiaskrgr opened this issue May 11, 2023 · 2 comments · Fixed by #111533
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

rustc -Zdrop-tracking-mir --edition=2021 -Z dump-mir-dir=dir

async fn async_extra_semicolon_different() {
    let _ = match true {};
}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (4d941cd98 2023-05-11)
binary: rustc
commit-hash: 4d941cd9812891af3b83dd4de64aa7d8ee99641a
commit-date: 2023-05-11
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

error[E0601]: `main` function not found in crate `treereduce`
 --> treereduce.out:3:2
  |
3 | }
  |  ^ consider adding a `main` function to `treereduce.out`

error[E0004]: non-exhaustive patterns: type `bool` is non-empty
 --> treereduce.out:2:19
  |
2 |     let _ = 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 _ = match true {
3 +         _ => todo!(),
4 ~     };
  |
Backtrace


error: internal compiler error: compiler/rustc_mir_transform/src/generator.rs:1413:14: unexpected generator type [type error]
 --> treereduce.out:1:44
  |
1 |   async fn async_extra_semicolon_different() {
  |  ____________________________________________^
2 | |     let _ = match true {};
3 | | }
  | |_^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/compiler/rustc_errors/src/lib.rs:994:33
stack backtrace:
   0:     0x7f9333f6a3b1 - std::backtrace_rs::backtrace::libunwind::trace::hfbd9a22e71a4118f
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9333f6a3b1 - std::backtrace_rs::backtrace::trace_unsynchronized::h2ca212d62678c7a7
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9333f6a3b1 - std::sys_common::backtrace::_print_fmt::hd000043c4568aad7
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f9333f6a3b1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8ca23c07934dca7c
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f9333fca80f - core::fmt::rt::Argument::fmt::hb1589a240b5fde94
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/core/src/fmt/rt.rs:138:9
   5:     0x7f9333fca80f - core::fmt::write::h18dfea3cbc3dab9b
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f9333f5d611 - std::io::Write::write_fmt::h1798cfd527f21abc
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/std/src/io/mod.rs:1712:15
   7:     0x7f9333f6a1c5 - std::sys_common::backtrace::_print::h0f21ce9c8646dd98
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f9333f6a1c5 - std::sys_common::backtrace::print::hb6933b606335110d
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f9333f6ce47 - std::panicking::default_hook::{{closure}}::hfcfa590c648c1065
  10:     0x7f9333f6cc34 - std::panicking::default_hook::he10736be1de367dd
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/std/src/panicking.rs:288:9
  11:     0x7f93371d861b - <rustc_driver_impl[78cd17ef754211c0]::install_ice_hook::{closure#0} as core[7c57b7e584e4aa89]::ops::function::FnOnce<(&core[7c57b7e584e4aa89]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7f9333f6d567 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hf479ce0f1fe3ed23
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/alloc/src/boxed.rs:1999:9
  13:     0x7f9333f6d567 - std::panicking::rust_panic_with_hook::hd9054c5a1f1cc02b
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/std/src/panicking.rs:695:13
  14:     0x7f93378c6d81 - std[6ab8612a6e74e769]::panicking::begin_panic::<rustc_errors[baa0a8dbe4b49832]::ExplicitBug>::{closure#0}
  15:     0x7f93378c51d6 - std[6ab8612a6e74e769]::sys_common::backtrace::__rust_end_short_backtrace::<std[6ab8612a6e74e769]::panicking::begin_panic<rustc_errors[baa0a8dbe4b49832]::ExplicitBug>::{closure#0}, !>
  16:     0x7f933793d436 - std[6ab8612a6e74e769]::panicking::begin_panic::<rustc_errors[baa0a8dbe4b49832]::ExplicitBug>
  17:     0x7f93378bef1e - <rustc_errors[baa0a8dbe4b49832]::HandlerInner>::span_bug::<rustc_span[e34fd09c8b02e1e2]::span_encoding::Span, alloc[f46bd7cb3eb5bf3d]::string::String>
  18:     0x7f93378bedad - <rustc_errors[baa0a8dbe4b49832]::Handler>::span_bug::<rustc_span[e34fd09c8b02e1e2]::span_encoding::Span, alloc[f46bd7cb3eb5bf3d]::string::String>
  19:     0x7f93378e850d - rustc_middle[496adb2a0252eb41]::util::bug::opt_span_bug_fmt::<rustc_span[e34fd09c8b02e1e2]::span_encoding::Span>::{closure#0}
  20:     0x7f93378e853a - rustc_middle[496adb2a0252eb41]::ty::context::tls::with_opt::<rustc_middle[496adb2a0252eb41]::util::bug::opt_span_bug_fmt<rustc_span[e34fd09c8b02e1e2]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f93378dd7da - rustc_middle[496adb2a0252eb41]::ty::context::tls::with_context_opt::<rustc_middle[496adb2a0252eb41]::ty::context::tls::with_opt<rustc_middle[496adb2a0252eb41]::util::bug::opt_span_bug_fmt<rustc_span[e34fd09c8b02e1e2]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f93360b8304 - rustc_middle[496adb2a0252eb41]::util::bug::span_bug_fmt::<rustc_span[e34fd09c8b02e1e2]::span_encoding::Span>
  23:     0x7f93378bdfbf - rustc_mir_transform[5a044c424bb12de4]::generator::mir_generator_witnesses
  24:     0x7f9337a72f39 - rustc_query_system[cf7d7821d6658afe]::query::plumbing::try_execute_query::<rustc_query_impl[b4d66289429fdc11]::queries::mir_generator_witnesses, rustc_query_impl[b4d66289429fdc11]::plumbing::QueryCtxt>
  25:     0x7f9337af7481 - rustc_query_impl[b4d66289429fdc11]::get_query::mir_generator_witnesses
  26:     0x7f933602a30e - rustc_middle[496adb2a0252eb41]::ty::query::query_get_at::<rustc_query_system[cf7d7821d6658afe]::query::caches::DefaultCache<rustc_span[e34fd09c8b02e1e2]::def_id::DefId, rustc_middle[496adb2a0252eb41]::query::erase::Erased<[u8; 8usize]>>>
  27:     0x7f9337684669 - <rustc_middle[496adb2a0252eb41]::ty::context::TyCtxt>::generator_hidden_types
  28:     0x7f9335b89b8e - <rustc_middle[496adb2a0252eb41]::ty::util::OpaqueTypeExpander as rustc_type_ir[b08cdc9cb399e65f]::fold::TypeFolder<rustc_middle[496adb2a0252eb41]::ty::context::TyCtxt>>::fold_ty
  29:     0x7f9335b89cf0 - rustc_middle[496adb2a0252eb41]::ty::util::fold_list::<rustc_middle[496adb2a0252eb41]::ty::util::OpaqueTypeExpander, rustc_middle[496adb2a0252eb41]::ty::subst::GenericArg, <&rustc_middle[496adb2a0252eb41]::ty::list::List<rustc_middle[496adb2a0252eb41]::ty::subst::GenericArg> as rustc_type_ir[b08cdc9cb399e65f]::fold::TypeFoldable<rustc_middle[496adb2a0252eb41]::ty::context::TyCtxt>>::try_fold_with<rustc_middle[496adb2a0252eb41]::ty::util::OpaqueTypeExpander>::{closure#0}>
  30:     0x7f9335b8a6fc - <rustc_middle[496adb2a0252eb41]::ty::Ty as rustc_type_ir[b08cdc9cb399e65f]::fold::TypeSuperFoldable<rustc_middle[496adb2a0252eb41]::ty::context::TyCtxt>>::super_fold_with::<rustc_middle[496adb2a0252eb41]::ty::util::OpaqueTypeExpander>
  31:     0x7f9335b899b3 - <rustc_middle[496adb2a0252eb41]::ty::util::OpaqueTypeExpander as rustc_type_ir[b08cdc9cb399e65f]::fold::TypeFolder<rustc_middle[496adb2a0252eb41]::ty::context::TyCtxt>>::fold_ty
  32:     0x7f933601ab20 - <rustc_middle[496adb2a0252eb41]::ty::util::OpaqueTypeExpander>::expand_opaque_ty
  33:     0x7f933601869e - <rustc_middle[496adb2a0252eb41]::ty::context::TyCtxt>::try_expand_impl_trait_type
  34:     0x7f9335ffb759 - rustc_hir_analysis[c3e187236081a148]::check::check::check_mod_item_types
  35:     0x7f933681de31 - rustc_query_system[cf7d7821d6658afe]::query::plumbing::try_execute_query::<rustc_query_impl[b4d66289429fdc11]::queries::check_mod_item_types, rustc_query_impl[b4d66289429fdc11]::plumbing::QueryCtxt>
  36:     0x7f933681da71 - rustc_query_impl[b4d66289429fdc11]::get_query::check_mod_item_types
  37:     0x7f933669f217 - <rustc_middle[496adb2a0252eb41]::hir::map::Map>::for_each_module::<rustc_hir_analysis[c3e187236081a148]::check_crate::{closure#6}::{closure#0}>
  38:     0x7f933669ee06 - <rustc_session[8f8f779bb70ae3a1]::session::Session>::time::<(), rustc_hir_analysis[c3e187236081a148]::check_crate::{closure#6}>
  39:     0x7f933669cc02 - rustc_hir_analysis[c3e187236081a148]::check_crate
  40:     0x7f93366910a0 - rustc_interface[5c70914ed5fe1f3e]::passes::analysis
  41:     0x7f9336945da7 - rustc_query_system[cf7d7821d6658afe]::query::plumbing::try_execute_query::<rustc_query_impl[b4d66289429fdc11]::queries::analysis, rustc_query_impl[b4d66289429fdc11]::plumbing::QueryCtxt>
  42:     0x7f9336945ac3 - rustc_query_impl[b4d66289429fdc11]::get_query::analysis
  43:     0x7f93363e2b5f - <rustc_middle[496adb2a0252eb41]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[78cd17ef754211c0]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[7c57b7e584e4aa89]::result::Result<(), rustc_span[e34fd09c8b02e1e2]::ErrorGuaranteed>>
  44:     0x7f93363e1c3f - <rustc_interface[5c70914ed5fe1f3e]::interface::Compiler>::enter::<rustc_driver_impl[78cd17ef754211c0]::run_compiler::{closure#1}::{closure#2}, core[7c57b7e584e4aa89]::result::Result<core[7c57b7e584e4aa89]::option::Option<rustc_interface[5c70914ed5fe1f3e]::queries::Linker>, rustc_span[e34fd09c8b02e1e2]::ErrorGuaranteed>>
  45:     0x7f93363df2cb - std[6ab8612a6e74e769]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5c70914ed5fe1f3e]::util::run_in_thread_pool_with_globals<rustc_interface[5c70914ed5fe1f3e]::interface::run_compiler<core[7c57b7e584e4aa89]::result::Result<(), rustc_span[e34fd09c8b02e1e2]::ErrorGuaranteed>, rustc_driver_impl[78cd17ef754211c0]::run_compiler::{closure#1}>::{closure#0}, core[7c57b7e584e4aa89]::result::Result<(), rustc_span[e34fd09c8b02e1e2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7c57b7e584e4aa89]::result::Result<(), rustc_span[e34fd09c8b02e1e2]::ErrorGuaranteed>>
  46:     0x7f9336ab11f5 - <<std[6ab8612a6e74e769]::thread::Builder>::spawn_unchecked_<rustc_interface[5c70914ed5fe1f3e]::util::run_in_thread_pool_with_globals<rustc_interface[5c70914ed5fe1f3e]::interface::run_compiler<core[7c57b7e584e4aa89]::result::Result<(), rustc_span[e34fd09c8b02e1e2]::ErrorGuaranteed>, rustc_driver_impl[78cd17ef754211c0]::run_compiler::{closure#1}>::{closure#0}, core[7c57b7e584e4aa89]::result::Result<(), rustc_span[e34fd09c8b02e1e2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7c57b7e584e4aa89]::result::Result<(), rustc_span[e34fd09c8b02e1e2]::ErrorGuaranteed>>::{closure#1} as core[7c57b7e584e4aa89]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  47:     0x7f9333f77a15 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he2255c6953e6fa30
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/alloc/src/boxed.rs:1985:9
  48:     0x7f9333f77a15 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0ca5b5af7207eb7e
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/alloc/src/boxed.rs:1985:9
  49:     0x7f9333f77a15 - std::sys::unix::thread::Thread::new::thread_start::h2a835efc5fa7f015
                               at /rustc/4d941cd9812891af3b83dd4de64aa7d8ee99641a/library/std/src/sys/unix/thread.rs:108:17
  50:     0x7f9333d14bb5 - <unknown>
  51:     0x7f9333d96d90 - <unknown>
  52:                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.71.0-nightly (4d941cd98 2023-05-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z drop-tracking-mir -Z dump-mir-dir=dir

query stack during panic:
#0 [mir_generator_witnesses] generator witness types for `async_extra_semicolon_different::{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 3 previous errors

Some errors have detailed explanations: E0004, E0601.
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. requires-nightly This issue requires a nightly compiler in some way. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue labels May 11, 2023
@matthiaskrgr
Copy link
Member Author

regression in #108705 cc @clubby789

@clubby789
Copy link
Contributor

Hmm, I guess that before this function just received broken MIR and carried on, but exited due to the HIR errors without trying to dump it. Now that we return an error body for broken code we're getting a panic

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) ❄️ requires-nightly This issue requires a nightly compiler in some way. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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.

2 participants