Skip to content

ICE: not yet implemented: FIXME(async_closures): Lower these to SMIR #134246

Closed
@matthiaskrgr

Description

snippet:

//@compile-flags: -Zunpretty=stable-mir --edition=2018
use std::future::ready;
pub fn main() {
    let mut vec: Vec<String> = vec![];

    let closure = async || {
        vec.push(ready(String::from("")).await);
    };
}

Version information

rustc 1.85.0-nightly (f4f0fafd0 2024-12-13)
binary: rustc
commit-hash: f4f0fafd0c7849e162eddbc69fa5fe82dbec28c7
commit-date: 2024-12-13
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.5

Possibly related line of code:

tables.coroutine_def(*def_id),
generic_arg.stable(tables),
tables.tcx.coroutine_movability(*def_id).stable(tables),
)
}
mir::AggregateKind::CoroutineClosure(..) => {
todo!("FIXME(async_closures): Lower these to SMIR")
}
mir::AggregateKind::RawPtr(ty, mutability) => {
stable_mir::mir::AggregateKind::RawPtr(ty.stable(tables), mutability.stable(tables))
}
}
}

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zunpretty=stable-mir --edition=2018

Program output

warning: unused variable: `closure`
 --> /tmp/icemaker_global_tempdir.AGr5o5x8v81C/rustc_testrunner_tmpdir_reporting.LjFuOhg1b1UO/mvce.rs:5:9
  |
5 |     let closure = async || {
  |         ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_closure`
  |
  = note: `#[warn(unused_variables)]` on by default

thread 'rustc' panicked at compiler/rustc_smir/src/rustc_smir/convert/mir.rs:569:17:
not yet implemented: FIXME(async_closures): Lower these to SMIR
stack backtrace:
   0:     0x728a3016887a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::ha7f0c0a9782d7e72
   1:     0x728a30813ba6 - core::fmt::write::h349a90590cd44cc2
   2:     0x728a317c5e51 - std::io::Write::write_fmt::hb75740cea2350d81
   3:     0x728a301686d2 - std::sys::backtrace::BacktraceLock::print::hbaa671e034187daa
   4:     0x728a3016abea - std::panicking::default_hook::{{closure}}::he5b32cfe851d3684
   5:     0x728a3016aa33 - std::panicking::default_hook::hfb25fc6fe8d3f7df
   6:     0x728a2f2cb5c8 - std[4908e3f2635a52b0]::panicking::update_hook::<alloc[d0f40dee7a07bc41]::boxed::Box<rustc_driver_impl[da799d46c754177c]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x728a3016b3a8 - std::panicking::rust_panic_with_hook::had4ab0340b9595a9
   8:     0x728a3016b066 - std::panicking::begin_panic_handler::{{closure}}::hfe00e9533ed00ed0
   9:     0x728a30168d19 - std::sys::backtrace::__rust_end_short_backtrace::h15687a7da048e988
  10:     0x728a3016ad5d - rust_begin_unwind
  11:     0x728a2cdb9920 - core::panicking::panic_fmt::h67b4e51ad0c096d3
  12:     0x728a2fe2d8a6 - <rustc_middle[925dc401787dd4f]::mir::syntax::AggregateKind as rustc_smir[2e64afc0fcf6e61f]::rustc_smir::Stable>::stable
  13:     0x728a2fe2c737 - <rustc_middle[925dc401787dd4f]::mir::syntax::Rvalue as rustc_smir[2e64afc0fcf6e61f]::rustc_smir::Stable>::stable
  14:     0x728a2fe2c51e - <rustc_middle[925dc401787dd4f]::mir::syntax::StatementKind as rustc_smir[2e64afc0fcf6e61f]::rustc_smir::Stable>::stable
  15:     0x728a2fe2ba58 - <rustc_middle[925dc401787dd4f]::mir::Body as rustc_smir[2e64afc0fcf6e61f]::rustc_smir::Stable>::stable
  16:     0x728a2fe20d57 - <rustc_smir[2e64afc0fcf6e61f]::rustc_smir::context::TablesWrapper as stable_mir[6ff77d18324bc8e5]::compiler_interface::Context>::mir_body
  17:     0x728a3012846c - <stable_mir[6ff77d18324bc8e5]::CrateItem>::body
  18:     0x728a2f2e8ee9 - rustc_driver_impl[da799d46c754177c]::pretty::print
  19:     0x728a31832a38 - rustc_interface[56d312c05374fed]::interface::run_compiler::<(), rustc_driver_impl[da799d46c754177c]::run_compiler::{closure#0}>::{closure#1}
  20:     0x728a3171c387 - std[4908e3f2635a52b0]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[56d312c05374fed]::util::run_in_thread_with_globals<rustc_interface[56d312c05374fed]::util::run_in_thread_pool_with_globals<rustc_interface[56d312c05374fed]::interface::run_compiler<(), rustc_driver_impl[da799d46c754177c]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  21:     0x728a3171c822 - <<std[4908e3f2635a52b0]::thread::Builder>::spawn_unchecked_<rustc_interface[56d312c05374fed]::util::run_in_thread_with_globals<rustc_interface[56d312c05374fed]::util::run_in_thread_pool_with_globals<rustc_interface[56d312c05374fed]::interface::run_compiler<(), rustc_driver_impl[da799d46c754177c]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[94282094966b97bc]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  22:     0x728a3171ddef - std::sys::pal::unix::thread::Thread::new::thread_start::h138d3ae6a4291935
  23:     0x728a2baa339d - <unknown>
  24:     0x728a2bb2849c - <unknown>
  25:                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.85.0-nightly (f4f0fafd0 2024-12-13) running on x86_64-unknown-linux-gnu

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

query stack during panic:
end of query stack
warning: 1 warning emitted


Metadata

Labels

A-stable-MIRArea: stable MIRC-bugCategory: This is a bug.F-async_closure`#![feature(async_closure)]`I-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