Skip to content

[ICE]: assertion left == right failed, left: std::future::ResumeTy, right: () #119058

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

Closed
1 of 4 tasks
mohe2015 opened this issue Dec 17, 2023 · 0 comments · Fixed by #119061
Closed
1 of 4 tasks

[ICE]: assertion left == right failed, left: std::future::ResumeTy, right: () #119058

mohe2015 opened this issue Dec 17, 2023 · 0 comments · Fixed by #119061
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

@mohe2015
Copy link
Contributor

Code

#![feature(async_iterator, gen_blocks, noop_waker)]

use std::{async_iter::AsyncIterator, pin::pin, task::{Context, Waker}};

pub fn main() {
    let async_iterator = pin!(async gen { yield "test" });
    let waker = Waker::noop();
    let ctx = &mut Context::from_waker(&waker);
    async_iterator.poll_next(ctx);
}

Affected release channels

  • Previous Stable
  • Current Stable
  • Current Beta
  • Current Nightly

Rust Version

rustc 1.76.0-nightly (445177724 2023-12-16)
binary: rustc
commit-hash: 445177724ac2beebf4faa5a3ffacb2adbe7e7846
commit-date: 2023-12-16
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.6

Current error output

No response

Backtrace

thread 'rustc' panicked at compiler/rustc_ty_utils/src/abi.rs:174:21:
assertion `left == right` failed
  left: std::future::ResumeTy
 right: ()
stack backtrace:
   0:     0x7f4aa2fe3edc - std::backtrace_rs::backtrace::libunwind::trace::h7d462dae69be89e5
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f4aa2fe3edc - std::backtrace_rs::backtrace::trace_unsynchronized::he731381aaced1e38
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f4aa2fe3edc - std::sys_common::backtrace::_print_fmt::h195f5c9c00833d35
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f4aa2fe3edc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0053b42c4d1d63ae
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f4aa3037040 - core::fmt::rt::Argument::fmt::h913450990a52c365
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/core/src/fmt/rt.rs:142:9
   5:     0x7f4aa3037040 - core::fmt::write::h5707c0aaab19fd3a
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f4aa2fd7def - std::io::Write::write_fmt::h4c73163f9cd5f03d
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/std/src/io/mod.rs:1810:15
   7:     0x7f4aa2fe3cc4 - std::sys_common::backtrace::_print::hfd7244b2fa9899c1
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f4aa2fe3cc4 - std::sys_common::backtrace::print::h5c65acc19a2c008b
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f4aa2fe6987 - std::panicking::default_hook::{{closure}}::hc7746e0dc7ed4e5e
  10:     0x7f4aa2fe66ef - std::panicking::default_hook::h7367bd9107ac6679
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/std/src/panicking.rs:292:9
  11:     0x7f4a9fd51520 - std[2241a118a71dd327]::panicking::update_hook::<alloc[a7c900cc42d1d3a7]::boxed::Box<rustc_driver_impl[584fee9d43f853a3]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f4aa2fe70a6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::he149af0da5aef09b
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/alloc/src/boxed.rs:2029:9
  13:     0x7f4aa2fe70a6 - std::panicking::rust_panic_with_hook::hbfa1c9355e904669
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/std/src/panicking.rs:783:13
  14:     0x7f4aa2fe6dfc - std::panicking::begin_panic_handler::{{closure}}::hdf202f447b582071
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/std/src/panicking.rs:657:13
  15:     0x7f4aa2fe4396 - std::sys_common::backtrace::__rust_end_short_backtrace::hbf111714b660571e
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f4aa2fe6b80 - rust_begin_unwind
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/std/src/panicking.rs:645:5
  17:     0x7f4aa3033745 - core::panicking::panic_fmt::h0d44e5490191d4d0
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/core/src/panicking.rs:72:14
  18:     0x7f4aa3033cdb - core::panicking::assert_failed_inner::hd26222ef5191b774
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/core/src/panicking.rs:342:17
  19:     0x7f4aa08ea1a3 - core[aaf102c868443a92]::panicking::assert_failed::<rustc_middle[524168e189d8c838]::ty::Ty, rustc_middle[524168e189d8c838]::ty::Ty>
  20:     0x7f4aa1547e69 - rustc_ty_utils[68ab7dd3530106d]::abi::fn_abi_of_instance
  21:     0x7f4aa1544501 - rustc_query_impl[6fcda27fce69b359]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6fcda27fce69b359]::query_impl::fn_abi_of_instance::dynamic_query::{closure#2}::{closure#0}, rustc_middle[524168e189d8c838]::query::erase::Erased<[u8; 16usize]>>
  22:     0x7f4aa15ddc41 - rustc_query_system[5a9da6ab9f4cd760]::query::plumbing::try_execute_query::<rustc_query_impl[6fcda27fce69b359]::DynamicConfig<rustc_query_system[5a9da6ab9f4cd760]::query::caches::DefaultCache<rustc_middle[524168e189d8c838]::ty::ParamEnvAnd<(rustc_middle[524168e189d8c838]::ty::instance::Instance, &rustc_middle[524168e189d8c838]::ty::list::List<rustc_middle[524168e189d8c838]::ty::Ty>)>, rustc_middle[524168e189d8c838]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[6fcda27fce69b359]::plumbing::QueryCtxt, true>
  23:     0x7f4aa15dd3ea - rustc_query_impl[6fcda27fce69b359]::query_impl::fn_abi_of_instance::get_query_incr::__rust_end_short_backtrace
  24:     0x7f4a9e56495e - <rustc_codegen_llvm[e5453e851ea71d3a]::context::CodegenCx as rustc_codegen_ssa[948bf90bbbf7093]::traits::declare::PreDefineMethods>::predefine_fn
  25:     0x7f4aa19491e3 - rustc_codegen_llvm[e5453e851ea71d3a]::base::compile_codegen_unit::module_codegen
  26:     0x7f4aa1f72605 - <rustc_codegen_llvm[e5453e851ea71d3a]::LlvmCodegenBackend as rustc_codegen_ssa[948bf90bbbf7093]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
  27:     0x7f4aa1f82380 - rustc_codegen_ssa[948bf90bbbf7093]::base::codegen_crate::<rustc_codegen_llvm[e5453e851ea71d3a]::LlvmCodegenBackend>
  28:     0x7f4aa1f81bfa - <rustc_codegen_llvm[e5453e851ea71d3a]::LlvmCodegenBackend as rustc_codegen_ssa[948bf90bbbf7093]::traits::backend::CodegenBackend>::codegen_crate
  29:     0x7f4aa1f7fd85 - rustc_interface[4dfaa8a239df06eb]::passes::start_codegen
  30:     0x7f4aa1f7f4fa - <rustc_interface[4dfaa8a239df06eb]::queries::Queries>::codegen_and_build_linker
  31:     0x7f4aa2042747 - rustc_interface[4dfaa8a239df06eb]::interface::run_compiler::<core[aaf102c868443a92]::result::Result<(), rustc_span[c215433fd65c8d88]::ErrorGuaranteed>, rustc_driver_impl[584fee9d43f853a3]::run_compiler::{closure#0}>::{closure#0}
  32:     0x7f4aa1fb7660 - std[2241a118a71dd327]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[4dfaa8a239df06eb]::util::run_in_thread_with_globals<rustc_interface[4dfaa8a239df06eb]::util::run_in_thread_pool_with_globals<rustc_interface[4dfaa8a239df06eb]::interface::run_compiler<core[aaf102c868443a92]::result::Result<(), rustc_span[c215433fd65c8d88]::ErrorGuaranteed>, rustc_driver_impl[584fee9d43f853a3]::run_compiler::{closure#0}>::{closure#0}, core[aaf102c868443a92]::result::Result<(), rustc_span[c215433fd65c8d88]::ErrorGuaranteed>>::{closure#0}, core[aaf102c868443a92]::result::Result<(), rustc_span[c215433fd65c8d88]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[aaf102c868443a92]::result::Result<(), rustc_span[c215433fd65c8d88]::ErrorGuaranteed>>
  33:     0x7f4aa1fb748f - <<std[2241a118a71dd327]::thread::Builder>::spawn_unchecked_<rustc_interface[4dfaa8a239df06eb]::util::run_in_thread_with_globals<rustc_interface[4dfaa8a239df06eb]::util::run_in_thread_pool_with_globals<rustc_interface[4dfaa8a239df06eb]::interface::run_compiler<core[aaf102c868443a92]::result::Result<(), rustc_span[c215433fd65c8d88]::ErrorGuaranteed>, rustc_driver_impl[584fee9d43f853a3]::run_compiler::{closure#0}>::{closure#0}, core[aaf102c868443a92]::result::Result<(), rustc_span[c215433fd65c8d88]::ErrorGuaranteed>>::{closure#0}, core[aaf102c868443a92]::result::Result<(), rustc_span[c215433fd65c8d88]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[aaf102c868443a92]::result::Result<(), rustc_span[c215433fd65c8d88]::ErrorGuaranteed>>::{closure#1} as core[aaf102c868443a92]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x7f4aa2ff0ef5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he015de65ac3a346b
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/alloc/src/boxed.rs:2015:9
  35:     0x7f4aa2ff0ef5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h594367a4025f4a68
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/alloc/src/boxed.rs:2015:9
  36:     0x7f4aa2ff0ef5 - std::sys::unix::thread::Thread::new::thread_start::hb319976c95d5f01a
                               at /rustc/445177724ac2beebf4faa5a3ffacb2adbe7e7846/library/std/src/sys/unix/thread.rs:108:17
  37:     0x7f4a9ceaa9eb - start_thread
                               at /usr/src/debug/glibc/glibc/nptl/pthread_create.c:444:8
  38:     0x7f4a9cf2e7cc - __GI___clone3
                               at /usr/src/debug/glibc/glibc/misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
  39:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

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 attach the file at `/home/moritz/Documents/async-templating/rustc-ice-2023-12-17T23_21_01-75542.txt` to your bug report

note: compiler flags: -Z unstable-options --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [fn_abi_of_instance] computing call ABI of `main::{closure#0}`
end of query stack

Anything else?

No response

@mohe2015 mohe2015 added 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. labels Dec 17, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 17, 2023
@compiler-errors compiler-errors self-assigned this Dec 18, 2023
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 18, 2023
bors added a commit to rust-lang-ci/rust that referenced this issue Dec 19, 2023
…leywiser

Desugar `yield` in `async gen` correctly, ensure `gen` always returns unit

1. Ensure `async gen` blocks desugar `yield $expr` to `task_context = yield async_gen_ready($expr)`. Previously we were not assigning the `task_context` correctly, meaning that `yield` expressions in async generators returned type `ResumeTy` instead of `()`, and that we were not storing the `task_context`  (which is probably unsound if we were reading the old task-context which has an invalidated borrow or something...)
2. Ensure that all `(async?) gen` blocks and `(async?) gen` fns return unit. Previously we were only checking this for `gen fn`, meaning that `gen {}` and `async gen {}` and `async gen fn` were allowed to return values that weren't unit. This is why rust-lang#119058 was an ICE rather than an E0308.

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