Skip to content

ICE: encountered Assign((_0, const false)) with incompatible types: left-hand side has type: std::task::Poll<std::option::Option<()>> right-hand side has type: bool #140530

Open
@matthiaskrgr

Description

@matthiaskrgr

snippet:

//@compile-flags: --edition=2024
#![feature(async_drop, gen_blocks)]
async gen fn a() {
  _ = async {}
}
fn main() {}

Version information

rustc 1.88.0-nightly (251cda5e1 2025-04-30)
binary: rustc
commit-hash: 251cda5e1f0057eb04fd9fc1653f2f1e010e8f97
commit-date: 2025-04-30
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2

Possibly related line of code:

};
cfg_checker.visit_body(body);
cfg_checker.check_cleanup_control_flow();
// Also run the TypeChecker.
for (location, msg) in validate_types(tcx, typing_env, body, body) {
cfg_checker.fail(location, msg);
}
if let MirPhase::Runtime(_) = body.phase {
if let ty::InstanceKind::Item(_) = body.source.instance {
if body.has_free_regions() {
cfg_checker.fail(

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

Program output

warning: the feature `async_drop` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.Q7ROmbIwMFgF/rustc_testrunner_tmpdir_reporting.yOBAckVbuhcE/mvce.rs:1:12
  |
1 | #![feature(async_drop, gen_blocks)]
  |            ^^^^^^^^^^
  |
  = note: see issue #126482 <https://github.com/rust-lang/rust/issues/126482> for more information
  = note: `#[warn(incomplete_features)]` on by default


thread 'rustc' panicked at compiler/rustc_mir_transform/src/validate.rs:80:25:
broken MIR in Item(DefId(0:5 ~ mvce[6f5e]::a::{closure#0})) (after phase change to runtime-optimized) at bb7[0]:
encountered `Assign((_0, const false))` with incompatible types:
left-hand side has type: std::task::Poll<std::option::Option<()>>
right-hand side has type: bool
stack backtrace:
   0:     0x762040763863 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h20b93d714a840c17
   1:     0x762040e059c7 - core::fmt::write::hbd4e43071f2b6280
   2:     0x76204220a091 - std::io::Write::write_fmt::hd6609147c061a65a
   3:     0x7620407636c2 - std::sys::backtrace::BacktraceLock::print::he17c913a476f0df2
   4:     0x76204076750a - std::panicking::default_hook::{{closure}}::h387e3e0861f6ca39
   5:     0x76204076708f - std::panicking::default_hook::h06a982276987baa3
   6:     0x76203f7a7633 - std[553e8cb93e7fb90]::panicking::update_hook::<alloc[6998e39f333261e4]::boxed::Box<rustc_driver_impl[48b038e11ca70c04]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x762040767d83 - std::panicking::rust_panic_with_hook::h0279421d7919da67
   8:     0x762040767a7a - std::panicking::begin_panic_handler::{{closure}}::hefe99212828ee7ee
   9:     0x762040763d39 - std::sys::backtrace::__rust_end_short_backtrace::h8c134fb05f0a8a31
  10:     0x76204076773d - __rustc[205ce94ebb068859]::rust_begin_unwind
  11:     0x76203d09cba0 - core::panicking::panic_fmt::h539a161d7912e603
  12:     0x76203e689602 - <rustc_mir_transform[13028d53c6d11955]::validate::CfgChecker>::fail::<alloc[6998e39f333261e4]::string::String>
  13:     0x762041ef8555 - <rustc_mir_transform[13028d53c6d11955]::validate::Validator as rustc_mir_transform[13028d53c6d11955]::pass_manager::MirPass>::run_pass
  14:     0x762040e03c4e - rustc_mir_transform[13028d53c6d11955]::pass_manager::run_passes_inner
  15:     0x7620417c707d - rustc_mir_transform[13028d53c6d11955]::run_optimization_passes
  16:     0x7620417c497d - rustc_mir_transform[13028d53c6d11955]::optimized_mir
  17:     0x7620417c451f - rustc_query_impl[73ffed637ff28f75]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[73ffed637ff28f75]::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fe83ff8f6af0fa19]::query::erase::Erased<[u8; 8usize]>>
  18:     0x7620411e712f - rustc_query_system[341c3edc9f45c813]::query::plumbing::try_execute_query::<rustc_query_impl[73ffed637ff28f75]::DynamicConfig<rustc_query_system[341c3edc9f45c813]::query::caches::DefIdCache<rustc_middle[fe83ff8f6af0fa19]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[73ffed637ff28f75]::plumbing::QueryCtxt, false>
  19:     0x7620411e655d - rustc_query_impl[73ffed637ff28f75]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
  20:     0x76203fe461e0 - <rustc_middle[fe83ff8f6af0fa19]::ty::context::TyCtxt>::coroutine_layout
  21:     0x7620414281cf - rustc_ty_utils[7e79272ab878db29]::layout::layout_of_uncached
  22:     0x762041416e4e - rustc_ty_utils[7e79272ab878db29]::layout::layout_of
  23:     0x762041416db2 - rustc_query_impl[73ffed637ff28f75]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[73ffed637ff28f75]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fe83ff8f6af0fa19]::query::erase::Erased<[u8; 16usize]>>
  24:     0x762041415baf - rustc_query_system[341c3edc9f45c813]::query::plumbing::try_execute_query::<rustc_query_impl[73ffed637ff28f75]::DynamicConfig<rustc_query_system[341c3edc9f45c813]::query::caches::DefaultCache<rustc_middle[fe83ff8f6af0fa19]::ty::PseudoCanonicalInput<rustc_middle[fe83ff8f6af0fa19]::ty::Ty>, rustc_middle[fe83ff8f6af0fa19]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[73ffed637ff28f75]::plumbing::QueryCtxt, false>
  25:     0x7620414157ee - rustc_query_impl[73ffed637ff28f75]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  26:     0x762041c5c9ee - <rustc_mir_transform[13028d53c6d11955]::known_panics_lint::KnownPanicsLint as rustc_mir_transform[13028d53c6d11955]::pass_manager::MirLint>::run_lint
  27:     0x762040e0bea7 - rustc_mir_transform[13028d53c6d11955]::run_analysis_to_runtime_passes
  28:     0x76204165abe5 - rustc_mir_transform[13028d53c6d11955]::mir_drops_elaborated_and_const_checked
  29:     0x76204165a5b7 - rustc_query_impl[73ffed637ff28f75]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[73ffed637ff28f75]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fe83ff8f6af0fa19]::query::erase::Erased<[u8; 8usize]>>
  30:     0x76204118746c - rustc_query_system[341c3edc9f45c813]::query::plumbing::try_execute_query::<rustc_query_impl[73ffed637ff28f75]::DynamicConfig<rustc_data_structures[cad23842afe3738d]::vec_cache::VecCache<rustc_span[1adb01313f1c57dc]::def_id::LocalDefId, rustc_middle[fe83ff8f6af0fa19]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[341c3edc9f45c813]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[73ffed637ff28f75]::plumbing::QueryCtxt, false>
  31:     0x762041186d4f - rustc_query_impl[73ffed637ff28f75]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7620418e66d8 - rustc_interface[39a942c1d345d61e]::passes::run_required_analyses
  33:     0x762041cf739e - rustc_interface[39a942c1d345d61e]::passes::analysis
  34:     0x762041cf736d - rustc_query_impl[73ffed637ff28f75]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[73ffed637ff28f75]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fe83ff8f6af0fa19]::query::erase::Erased<[u8; 0usize]>>
  35:     0x762041cfce7d - rustc_query_system[341c3edc9f45c813]::query::plumbing::try_execute_query::<rustc_query_impl[73ffed637ff28f75]::DynamicConfig<rustc_query_system[341c3edc9f45c813]::query::caches::SingleCache<rustc_middle[fe83ff8f6af0fa19]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[73ffed637ff28f75]::plumbing::QueryCtxt, false>
  36:     0x762041cfcb78 - rustc_query_impl[73ffed637ff28f75]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  37:     0x762041d3a8be - rustc_interface[39a942c1d345d61e]::passes::create_and_enter_global_ctxt::<core[f0a60fd3088b4ecc]::option::Option<rustc_interface[39a942c1d345d61e]::queries::Linker>, rustc_driver_impl[48b038e11ca70c04]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  38:     0x762041e6b254 - rustc_interface[39a942c1d345d61e]::interface::run_compiler::<(), rustc_driver_impl[48b038e11ca70c04]::run_compiler::{closure#0}>::{closure#1}
  39:     0x762041e92c74 - std[553e8cb93e7fb90]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[39a942c1d345d61e]::util::run_in_thread_with_globals<rustc_interface[39a942c1d345d61e]::util::run_in_thread_pool_with_globals<rustc_interface[39a942c1d345d61e]::interface::run_compiler<(), rustc_driver_impl[48b038e11ca70c04]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  40:     0x762041e930b4 - <<std[553e8cb93e7fb90]::thread::Builder>::spawn_unchecked_<rustc_interface[39a942c1d345d61e]::util::run_in_thread_with_globals<rustc_interface[39a942c1d345d61e]::util::run_in_thread_pool_with_globals<rustc_interface[39a942c1d345d61e]::interface::run_compiler<(), rustc_driver_impl[48b038e11ca70c04]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[f0a60fd3088b4ecc]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x762041e944ab - std::sys::pal::unix::thread::Thread::new::thread_start::h263b7b8b08c5ad3d
  42:     0x76203bca370a - <unknown>
  43:     0x76203bd27aac - <unknown>
  44:                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 make sure that you have updated to the latest nightly

note: rustc 1.88.0-nightly (251cda5e1 2025-04-30) running on x86_64-unknown-linux-gnu

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

query stack during panic:
#0 [optimized_mir] optimizing MIR for `a::{closure#0}`
#1 [layout_of] computing layout of `{async gen fn body of a()}`
#2 [mir_drops_elaborated_and_const_checked] elaborating drops for `a`
#3 [analysis] running analysis passes on this crate
end of query stack
warning: 1 warning emitted


@rustbot label +F-async_drop +F-gen_blocks

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-async_drop`#![feature(async_drop)]`F-gen_blocks`gen {}` expressions that produce `Iterator`sI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions