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: index out of bounds, instrument coverage #131190

Closed
matthiaskrgr opened this issue Oct 3, 2024 · 5 comments · Fixed by #131802
Closed

ICE: index out of bounds, instrument coverage #131190

matthiaskrgr opened this issue Oct 3, 2024 · 5 comments · Fixed by #131802
Assignees
Labels
A-async-await Area: Async & Await A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) AsyncAwait-Triaged Async-await issues that have been triaged during a working group meeting. C-bug Category: This is a bug. F-async_closure `#![feature(async_closure)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

use std::future::Future;

pub fn block_on<T>(fut: impl Future<Output = T>) -> T {}

async fn call_once(f: impl async FnOnce(DropMe)) {
    f(DropMe("world")).await;
}

struct DropMe(&'static str);

pub fn main() {
    block_on(async {
        let async_closure = async move |a: DropMe| {};
        call_once(async_closure).await;
    });
}

original:

#![feature(async_closure, noop_waker, async_fn_traits)]

use std::future::Future;
use std::pin::pin;
use std::task::*;

pub fn block_on<T>(fut: impl Future<Output = T>) -> T {
    let mut fut = pin!(fut);
    let ctx = &mut Context::from_waker(Waker::noop());

    loop {
        match fut.as_mut().poll(ctx) {
            Poll::Pending => {}
            Poll::Ready(t) => break t,
        }
    }
}

async fn call_once(f: impl async FnOnce(DropMe)) {
    f(DropMe("world")).await;
}

#[derive(Debug)]
struct DropMe(&'static str);

impl Drop for DropMe {
    fn drop(&mut self) {
        println!("{}", self.0);
    }
}

pub fn main() {
    block_on(async {
        let b = DropMe("hello");
        let async_closure = async move |a: DropMe| {
            println!("{a:?} {b:?}");
        };
        call_once(async_closure).await;
    });
}

Version information

rustc 1.83.0-nightly (888523978 2024-10-03)
binary: rustc
commit-hash: 8885239786c9efe5c6077de65536a5e092e34a55
commit-date: 2024-10-03
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Cinstrument-coverage --edition=2018

Program output

error[E0658]: async closures are unstable
 --> /tmp/icemaker_global_tempdir.oaNujPif49Om/rustc_testrunner_tmpdir_reporting.OG1eQwd5cy9L/mvce.rs:5:28
  |
5 | async fn call_once(f: impl async FnOnce(DropMe)) {
  |                            ^^^^^
  |
  = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
  = help: add `#![feature(async_closure)]` to the crate attributes to enable
  = note: this compiler was built on 2024-10-03; consider upgrading it if it is out of date
  = help: to use an async block, remove the `||`: `async {`

error[E0658]: async closures are unstable
  --> /tmp/icemaker_global_tempdir.oaNujPif49Om/rustc_testrunner_tmpdir_reporting.OG1eQwd5cy9L/mvce.rs:13:29
   |
13 |         let async_closure = async move |a: DropMe| {};
   |                             ^^^^^
   |
   = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
   = help: add `#![feature(async_closure)]` to the crate attributes to enable
   = note: this compiler was built on 2024-10-03; consider upgrading it if it is out of date
   = help: to use an async block, remove the `||`: `async {`

error[E0658]: use of unstable library feature 'async_closure'
 --> /tmp/icemaker_global_tempdir.oaNujPif49Om/rustc_testrunner_tmpdir_reporting.OG1eQwd5cy9L/mvce.rs:5:34
  |
5 | async fn call_once(f: impl async FnOnce(DropMe)) {
  |                                  ^^^^^^^^^^^^^^
  |
  = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
  = help: add `#![feature(async_closure)]` to the crate attributes to enable
  = note: this compiler was built on 2024-10-03; consider upgrading it if it is out of date

error[E0308]: mismatched types
 --> /tmp/icemaker_global_tempdir.oaNujPif49Om/rustc_testrunner_tmpdir_reporting.OG1eQwd5cy9L/mvce.rs:3:53
  |
3 | pub fn block_on<T>(fut: impl Future<Output = T>) -> T {}
  |        -------- -                                   ^ expected type parameter `T`, found `()`
  |        |        |
  |        |        expected this type parameter
  |        implicitly returns `()` as its body has no tail or `return` expression
  |
  = note: expected type parameter `T`
                  found unit type `()`

warning: unused variable: `a`
  --> /tmp/icemaker_global_tempdir.oaNujPif49Om/rustc_testrunner_tmpdir_reporting.OG1eQwd5cy9L/mvce.rs:13:41
   |
13 |         let async_closure = async move |a: DropMe| {};
   |                                         ^ help: if this is intentional, prefix it with an underscore: `_a`
   |
   = note: `#[warn(unused_variables)]` on by default

thread 'rustc' panicked at /rustc/8885239786c9efe5c6077de65536a5e092e34a55/compiler/rustc_middle/src/hir/mod.rs:167:84:
index out of bounds: the len is 18 but the index is 18
stack backtrace:
   0:     0x7beaa312055a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hb592cf74724b425e
   1:     0x7beaa3803426 - core::fmt::write::hf5d6063860bea70f
   2:     0x7beaa49e0e51 - std::io::Write::write_fmt::hffd3de1a22689c3f
   3:     0x7beaa31203b2 - std::sys::backtrace::BacktraceLock::print::h63270fe5b69f528d
   4:     0x7beaa3122886 - std::panicking::default_hook::{{closure}}::heab8066707c891e2
   5:     0x7beaa31226d0 - std::panicking::default_hook::h04bff44e2827e0a1
   6:     0x7beaa21d718f - std[a04536816f5670be]::panicking::update_hook::<alloc[c3cd3301d2874f1]::boxed::Box<rustc_driver_impl[d8d06b747560f99c]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7beaa3122f98 - std::panicking::rust_panic_with_hook::h8c4b4462dd073994
   8:     0x7beaa3122d6a - std::panicking::begin_panic_handler::{{closure}}::h3e8c389e20c1d0de
   9:     0x7beaa3120a09 - std::sys::backtrace::__rust_end_short_backtrace::h8ff57cfb18e819fb
  10:     0x7beaa3122a2c - rust_begin_unwind
  11:     0x7bea9fec29e0 - core::panicking::panic_fmt::h1ebaebc26e6fd1b2
  12:     0x7beaa19291ab - core::panicking::panic_bounds_check::hc44d35339120f09a
  13:     0x7beaa3b2dd08 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::local_def_id_to_hir_id::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 8usize]>>
  14:     0x7beaa3b2d31b - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::VecCache<rustc_span[3db820fc671a7841]::def_id::LocalDefId, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  15:     0x7beaa3b2ce4f - rustc_query_impl[a29eb790b8655a40]::query_impl::local_def_id_to_hir_id::get_query_non_incr::__rust_end_short_backtrace
  16:     0x7beaa295ea8c - rustc_middle[5107f05ab9282e45]::query::plumbing::query_get_at::<rustc_query_system[fcc792b70dcbd9a8]::query::caches::VecCache<rustc_span[3db820fc671a7841]::def_id::LocalDefId, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 8usize]>>>
  17:     0x7beaa29e35f6 - rustc_mir_transform[d3e5830c4043327a]::coverage::query::coverage_attr_on
  18:     0x7beaa2c2d297 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::coverage_attr_on::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 1usize]>>
  19:     0x7beaa4207ba9 - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::VecCache<rustc_span[3db820fc671a7841]::def_id::LocalDefId, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  20:     0x7beaa2c367c7 - rustc_query_impl[a29eb790b8655a40]::query_impl::coverage_attr_on::get_query_non_incr::__rust_end_short_backtrace
  21:     0x7beaa295e8ff - rustc_middle[5107f05ab9282e45]::query::plumbing::query_get_at::<rustc_query_system[fcc792b70dcbd9a8]::query::caches::VecCache<rustc_span[3db820fc671a7841]::def_id::LocalDefId, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 1usize]>>>
  22:     0x7beaa29e35b6 - rustc_mir_transform[d3e5830c4043327a]::coverage::query::is_eligible_for_coverage
  23:     0x7beaa29e878e - <rustc_mir_transform[d3e5830c4043327a]::coverage::InstrumentCoverage as rustc_mir_transform[d3e5830c4043327a]::pass_manager::MirPass>::run_pass
  24:     0x7beaa0c88d94 - rustc_mir_transform[d3e5830c4043327a]::mir_promoted
  25:     0x7beaa3c72152 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>
  26:     0x7beaa3c72421 - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::VecCache<rustc_span[3db820fc671a7841]::def_id::LocalDefId, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  27:     0x7beaa47ba350 - rustc_query_impl[a29eb790b8655a40]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7beaa4cc2c0d - rustc_middle[5107f05ab9282e45]::query::plumbing::query_get_at::<rustc_query_system[fcc792b70dcbd9a8]::query::caches::VecCache<rustc_span[3db820fc671a7841]::def_id::LocalDefId, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>>.cold
  29:     0x7beaa2a34aca - rustc_mir_transform[d3e5830c4043327a]::coroutine::mir_coroutine_witnesses
  30:     0x7beaa2c2d8b2 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::mir_coroutine_witnesses::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 8usize]>>
  31:     0x7beaa382f5ae - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::DefIdCache<rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  32:     0x7beaa2c35d0e - rustc_query_impl[a29eb790b8655a40]::query_impl::mir_coroutine_witnesses::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7beaa40fe2f4 - rustc_mir_transform[d3e5830c4043327a]::mir_drops_elaborated_and_const_checked
  34:     0x7beaa40fd595 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 8usize]>>
  35:     0x7beaa3b2d0fa - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::VecCache<rustc_span[3db820fc671a7841]::def_id::LocalDefId, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  36:     0x7beaa3b2caa5 - rustc_query_impl[a29eb790b8655a40]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7beaa3a45b6a - rustc_mir_transform[d3e5830c4043327a]::optimized_mir
  38:     0x7beaa3a442a1 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 8usize]>>
  39:     0x7beaa382f5ae - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::DefIdCache<rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  40:     0x7beaa382eb5f - rustc_query_impl[a29eb790b8655a40]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7beaa3e29f01 - rustc_middle[5107f05ab9282e45]::query::plumbing::query_get_at::<rustc_query_system[fcc792b70dcbd9a8]::query::caches::DefIdCache<rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 8usize]>>>
  42:     0x7beaa2848a5e - <rustc_middle[5107f05ab9282e45]::ty::context::TyCtxt>::coroutine_layout
  43:     0x7beaa3ec8ad9 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of_uncached
  44:     0x7beaa3eb9646 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of
  45:     0x7beaa3eb95d1 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>
  46:     0x7beaa3eb884d - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::DefaultCache<rustc_middle[5107f05ab9282e45]::ty::ParamEnvAnd<rustc_middle[5107f05ab9282e45]::ty::Ty>, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  47:     0x7beaa3eb84e7 - rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  48:     0x7beaa3eb763c - <core[cb6fe1446f4e495e]::iter::adapters::GenericShunt<core[cb6fe1446f4e495e]::iter::adapters::by_ref_sized::ByRefSized<core[cb6fe1446f4e495e]::iter::adapters::map::Map<core[cb6fe1446f4e495e]::slice::iter::Iter<rustc_middle[5107f05ab9282e45]::ty::VariantDef>, rustc_ty_utils[40b1ed103802e44]::layout::layout_of_uncached::{closure#13}>>, core[cb6fe1446f4e495e]::result::Result<core[cb6fe1446f4e495e]::convert::Infallible, &rustc_middle[5107f05ab9282e45]::ty::layout::LayoutError>> as core[cb6fe1446f4e495e]::iter::traits::iterator::Iterator>::next
  49:     0x7beaa3ebe0d0 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of_uncached
  50:     0x7beaa3eb9646 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of
  51:     0x7beaa3eb95d1 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>
  52:     0x7beaa3eb884d - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::DefaultCache<rustc_middle[5107f05ab9282e45]::ty::ParamEnvAnd<rustc_middle[5107f05ab9282e45]::ty::Ty>, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  53:     0x7beaa3eb84e7 - rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  54:     0x7beaa3eb79bd - <core[cb6fe1446f4e495e]::iter::adapters::GenericShunt<core[cb6fe1446f4e495e]::iter::adapters::by_ref_sized::ByRefSized<core[cb6fe1446f4e495e]::iter::adapters::map::Map<core[cb6fe1446f4e495e]::slice::iter::Iter<rustc_middle[5107f05ab9282e45]::ty::VariantDef>, rustc_ty_utils[40b1ed103802e44]::layout::layout_of_uncached::{closure#13}>>, core[cb6fe1446f4e495e]::result::Result<core[cb6fe1446f4e495e]::convert::Infallible, &rustc_middle[5107f05ab9282e45]::ty::layout::LayoutError>> as core[cb6fe1446f4e495e]::iter::traits::iterator::Iterator>::next
  55:     0x7beaa3ebe0d0 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of_uncached
  56:     0x7beaa3eb9646 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of
  57:     0x7beaa3eb95d1 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>
  58:     0x7beaa3eb884d - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::DefaultCache<rustc_middle[5107f05ab9282e45]::ty::ParamEnvAnd<rustc_middle[5107f05ab9282e45]::ty::Ty>, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  59:     0x7beaa3eb84e7 - rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  60:     0x7beaa3eb511d - rustc_middle[5107f05ab9282e45]::query::plumbing::query_get_at::<rustc_query_system[fcc792b70dcbd9a8]::query::caches::DefaultCache<rustc_middle[5107f05ab9282e45]::ty::ParamEnvAnd<rustc_middle[5107f05ab9282e45]::ty::Ty>, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>>
  61:     0x7beaa3eb99f2 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of
  62:     0x7beaa3eb95d1 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>
  63:     0x7beaa3eb884d - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::DefaultCache<rustc_middle[5107f05ab9282e45]::ty::ParamEnvAnd<rustc_middle[5107f05ab9282e45]::ty::Ty>, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  64:     0x7beaa3eb84e7 - rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  65:     0x7beaa3eb511d - rustc_middle[5107f05ab9282e45]::query::plumbing::query_get_at::<rustc_query_system[fcc792b70dcbd9a8]::query::caches::DefaultCache<rustc_middle[5107f05ab9282e45]::ty::ParamEnvAnd<rustc_middle[5107f05ab9282e45]::ty::Ty>, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>>
  66:     0x7beaa309b19a - <rustc_middle[5107f05ab9282e45]::ty::layout::LayoutCx as rustc_middle[5107f05ab9282e45]::ty::layout::LayoutOf>::spanned_layout_of
  67:     0x7beaa308717e - <core[cb6fe1446f4e495e]::iter::adapters::GenericShunt<core[cb6fe1446f4e495e]::iter::adapters::by_ref_sized::ByRefSized<core[cb6fe1446f4e495e]::iter::adapters::chain::Chain<core[cb6fe1446f4e495e]::iter::adapters::chain::Chain<core[cb6fe1446f4e495e]::iter::adapters::map::Map<core[cb6fe1446f4e495e]::iter::adapters::copied::Copied<core[cb6fe1446f4e495e]::slice::iter::Iter<rustc_middle[5107f05ab9282e45]::ty::Ty>>, rustc_ty_utils[40b1ed103802e44]::layout::coroutine_layout::{closure#2}>, core[cb6fe1446f4e495e]::iter::sources::once::Once<core[cb6fe1446f4e495e]::result::Result<rustc_target[b87216030bef1d77]::abi::TyAndLayout<rustc_middle[5107f05ab9282e45]::ty::Ty>, &rustc_middle[5107f05ab9282e45]::ty::layout::LayoutError>>>, core[cb6fe1446f4e495e]::iter::adapters::map::Map<rustc_index[bfdec4fad9c39491]::bit_set::BitIter<rustc_middle[5107f05ab9282e45]::mir::query::CoroutineSavedLocal>, rustc_ty_utils[40b1ed103802e44]::layout::coroutine_layout::{closure#1}>>>, core[cb6fe1446f4e495e]::result::Result<core[cb6fe1446f4e495e]::convert::Infallible, &rustc_middle[5107f05ab9282e45]::ty::layout::LayoutError>> as core[cb6fe1446f4e495e]::iter::traits::iterator::Iterator>::next
  68:     0x7beaa3ec9199 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of_uncached
  69:     0x7beaa3eb9646 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of
  70:     0x7beaa3eb95d1 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>
  71:     0x7beaa3eb884d - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::DefaultCache<rustc_middle[5107f05ab9282e45]::ty::ParamEnvAnd<rustc_middle[5107f05ab9282e45]::ty::Ty>, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  72:     0x7beaa3eb84e7 - rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  73:     0x7beaa3eb763c - <core[cb6fe1446f4e495e]::iter::adapters::GenericShunt<core[cb6fe1446f4e495e]::iter::adapters::by_ref_sized::ByRefSized<core[cb6fe1446f4e495e]::iter::adapters::map::Map<core[cb6fe1446f4e495e]::slice::iter::Iter<rustc_middle[5107f05ab9282e45]::ty::VariantDef>, rustc_ty_utils[40b1ed103802e44]::layout::layout_of_uncached::{closure#13}>>, core[cb6fe1446f4e495e]::result::Result<core[cb6fe1446f4e495e]::convert::Infallible, &rustc_middle[5107f05ab9282e45]::ty::layout::LayoutError>> as core[cb6fe1446f4e495e]::iter::traits::iterator::Iterator>::next
  74:     0x7beaa3ebe0d0 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of_uncached
  75:     0x7beaa3eb9646 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of
  76:     0x7beaa3eb95d1 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>
  77:     0x7beaa3eb884d - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::DefaultCache<rustc_middle[5107f05ab9282e45]::ty::ParamEnvAnd<rustc_middle[5107f05ab9282e45]::ty::Ty>, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  78:     0x7beaa3eb84e7 - rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  79:     0x7beaa3eb79bd - <core[cb6fe1446f4e495e]::iter::adapters::GenericShunt<core[cb6fe1446f4e495e]::iter::adapters::by_ref_sized::ByRefSized<core[cb6fe1446f4e495e]::iter::adapters::map::Map<core[cb6fe1446f4e495e]::slice::iter::Iter<rustc_middle[5107f05ab9282e45]::ty::VariantDef>, rustc_ty_utils[40b1ed103802e44]::layout::layout_of_uncached::{closure#13}>>, core[cb6fe1446f4e495e]::result::Result<core[cb6fe1446f4e495e]::convert::Infallible, &rustc_middle[5107f05ab9282e45]::ty::layout::LayoutError>> as core[cb6fe1446f4e495e]::iter::traits::iterator::Iterator>::next
  80:     0x7beaa3ebe0d0 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of_uncached
  81:     0x7beaa3eb9646 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of
  82:     0x7beaa3eb95d1 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>
  83:     0x7beaa3eb884d - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::DefaultCache<rustc_middle[5107f05ab9282e45]::ty::ParamEnvAnd<rustc_middle[5107f05ab9282e45]::ty::Ty>, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  84:     0x7beaa3eb84e7 - rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  85:     0x7beaa3eb511d - rustc_middle[5107f05ab9282e45]::query::plumbing::query_get_at::<rustc_query_system[fcc792b70dcbd9a8]::query::caches::DefaultCache<rustc_middle[5107f05ab9282e45]::ty::ParamEnvAnd<rustc_middle[5107f05ab9282e45]::ty::Ty>, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>>
  86:     0x7beaa309b19a - <rustc_middle[5107f05ab9282e45]::ty::layout::LayoutCx as rustc_middle[5107f05ab9282e45]::ty::layout::LayoutOf>::spanned_layout_of
  87:     0x7beaa308717e - <core[cb6fe1446f4e495e]::iter::adapters::GenericShunt<core[cb6fe1446f4e495e]::iter::adapters::by_ref_sized::ByRefSized<core[cb6fe1446f4e495e]::iter::adapters::chain::Chain<core[cb6fe1446f4e495e]::iter::adapters::chain::Chain<core[cb6fe1446f4e495e]::iter::adapters::map::Map<core[cb6fe1446f4e495e]::iter::adapters::copied::Copied<core[cb6fe1446f4e495e]::slice::iter::Iter<rustc_middle[5107f05ab9282e45]::ty::Ty>>, rustc_ty_utils[40b1ed103802e44]::layout::coroutine_layout::{closure#2}>, core[cb6fe1446f4e495e]::iter::sources::once::Once<core[cb6fe1446f4e495e]::result::Result<rustc_target[b87216030bef1d77]::abi::TyAndLayout<rustc_middle[5107f05ab9282e45]::ty::Ty>, &rustc_middle[5107f05ab9282e45]::ty::layout::LayoutError>>>, core[cb6fe1446f4e495e]::iter::adapters::map::Map<rustc_index[bfdec4fad9c39491]::bit_set::BitIter<rustc_middle[5107f05ab9282e45]::mir::query::CoroutineSavedLocal>, rustc_ty_utils[40b1ed103802e44]::layout::coroutine_layout::{closure#1}>>>, core[cb6fe1446f4e495e]::result::Result<core[cb6fe1446f4e495e]::convert::Infallible, &rustc_middle[5107f05ab9282e45]::ty::layout::LayoutError>> as core[cb6fe1446f4e495e]::iter::traits::iterator::Iterator>::next
  88:     0x7beaa3ec9199 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of_uncached
  89:     0x7beaa3eb9646 - rustc_ty_utils[40b1ed103802e44]::layout::layout_of
  90:     0x7beaa3eb95d1 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>
  91:     0x7beaa3eb884d - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::DefaultCache<rustc_middle[5107f05ab9282e45]::ty::ParamEnvAnd<rustc_middle[5107f05ab9282e45]::ty::Ty>, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  92:     0x7beaa3eb84e7 - rustc_query_impl[a29eb790b8655a40]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  93:     0x7beaa0dcd2ad - <rustc_mir_transform[d3e5830c4043327a]::known_panics_lint::KnownPanicsLint as rustc_mir_transform[d3e5830c4043327a]::pass_manager::MirLint>::run_lint
  94:     0x7beaa3806acc - rustc_mir_transform[d3e5830c4043327a]::run_analysis_to_runtime_passes
  95:     0x7beaa40fdc52 - rustc_mir_transform[d3e5830c4043327a]::mir_drops_elaborated_and_const_checked
  96:     0x7beaa40fd595 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 8usize]>>
  97:     0x7beaa3b2d0fa - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::VecCache<rustc_span[3db820fc671a7841]::def_id::LocalDefId, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
  98:     0x7beaa3b2caa5 - rustc_query_impl[a29eb790b8655a40]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  99:     0x7beaa3b26cd2 - rustc_interface[ec6f4c50e1aefefe]::passes::run_required_analyses
 100:     0x7beaa463d41e - rustc_interface[ec6f4c50e1aefefe]::passes::analysis
 101:     0x7beaa463d3f1 - rustc_query_impl[a29eb790b8655a40]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a29eb790b8655a40]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 1usize]>>
 102:     0x7beaa46d772e - rustc_query_system[fcc792b70dcbd9a8]::query::plumbing::try_execute_query::<rustc_query_impl[a29eb790b8655a40]::DynamicConfig<rustc_query_system[fcc792b70dcbd9a8]::query::caches::SingleCache<rustc_middle[5107f05ab9282e45]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[a29eb790b8655a40]::plumbing::QueryCtxt, false>
 103:     0x7beaa46d740f - rustc_query_impl[a29eb790b8655a40]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
 104:     0x7beaa454051e - rustc_interface[ec6f4c50e1aefefe]::interface::run_compiler::<core[cb6fe1446f4e495e]::result::Result<(), rustc_span[3db820fc671a7841]::ErrorGuaranteed>, rustc_driver_impl[d8d06b747560f99c]::run_compiler::{closure#0}>::{closure#1}
 105:     0x7beaa4624810 - std[a04536816f5670be]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[ec6f4c50e1aefefe]::util::run_in_thread_with_globals<rustc_interface[ec6f4c50e1aefefe]::util::run_in_thread_pool_with_globals<rustc_interface[ec6f4c50e1aefefe]::interface::run_compiler<core[cb6fe1446f4e495e]::result::Result<(), rustc_span[3db820fc671a7841]::ErrorGuaranteed>, rustc_driver_impl[d8d06b747560f99c]::run_compiler::{closure#0}>::{closure#1}, core[cb6fe1446f4e495e]::result::Result<(), rustc_span[3db820fc671a7841]::ErrorGuaranteed>>::{closure#0}, core[cb6fe1446f4e495e]::result::Result<(), rustc_span[3db820fc671a7841]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cb6fe1446f4e495e]::result::Result<(), rustc_span[3db820fc671a7841]::ErrorGuaranteed>>
 106:     0x7beaa4624ed7 - <<std[a04536816f5670be]::thread::Builder>::spawn_unchecked_<rustc_interface[ec6f4c50e1aefefe]::util::run_in_thread_with_globals<rustc_interface[ec6f4c50e1aefefe]::util::run_in_thread_pool_with_globals<rustc_interface[ec6f4c50e1aefefe]::interface::run_compiler<core[cb6fe1446f4e495e]::result::Result<(), rustc_span[3db820fc671a7841]::ErrorGuaranteed>, rustc_driver_impl[d8d06b747560f99c]::run_compiler::{closure#0}>::{closure#1}, core[cb6fe1446f4e495e]::result::Result<(), rustc_span[3db820fc671a7841]::ErrorGuaranteed>>::{closure#0}, core[cb6fe1446f4e495e]::result::Result<(), rustc_span[3db820fc671a7841]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cb6fe1446f4e495e]::result::Result<(), rustc_span[3db820fc671a7841]::ErrorGuaranteed>>::{closure#1} as core[cb6fe1446f4e495e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
 107:     0x7beaa4625dc1 - std::sys::pal::unix::thread::Thread::new::thread_start::heca97faccc80f502
 108:     0x7bea9eaa339d - <unknown>
 109:     0x7bea9eb2849c - <unknown>
 110:                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.83.0-nightly (888523978 2024-10-03) running on x86_64-unknown-linux-gnu

note: compiler flags: -C instrument-coverage -Z dump-mir-dir=dir

query stack during panic:
#0 [local_def_id_to_hir_id] getting HIR ID of `main::{closure#0}::{closure#0}::{closure#1}`
#1 [coverage_attr_on] checking for `#[coverage(..)]` on `main::{closure#0}::{closure#0}::{closure#1}`
end of query stack
error: aborting due to 4 previous errors; 1 warning emitted

Some errors have detailed explanations: E0308, E0658.
For more information about an error, try `rustc --explain E0308`.

@rustbot label +F-async_closure +F-noop_waker +F-async_fn_traits

@matthiaskrgr matthiaskrgr added A-async-await Area: Async & Await A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) 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 Oct 3, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 3, 2024
@traviscross
Copy link
Contributor

@rustbot labels -needs-triage +AsyncAwait-Triaged

Interesting, as always, @matthiaskrgr. Thanks for the report.

@rustbot rustbot added AsyncAwait-Triaged Async-await issues that have been triaged during a working group meeting. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 3, 2024
@ranger-ross
Copy link
Contributor

Bisected to nightly-2024-09-18,

Regression in 41a3e06 from #130201

@traviscross
Copy link
Contributor

cc @compiler-errors given bisection.

@compiler-errors
Copy link
Member

I'll look

@compiler-errors

This comment has been minimized.

@traviscross traviscross added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 7, 2024
@compiler-errors compiler-errors self-assigned this Oct 7, 2024
@compiler-errors compiler-errors added F-async_closure `#![feature(async_closure)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 7, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Oct 12, 2024
@bors bors closed this as completed in aae4730 Oct 18, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 18, 2024
Rollup merge of rust-lang#131802 - compiler-errors:fnonce-coverage, r=Zalathar

Dont ICE when computing coverage of synthetic async closure body

I'm not totally certain if this is *right*, but at least it doesn't ICE.

The issue is that we end up generating two MIR bodies for each async closure, since the `FnOnce` and `Fn`/`FnMut` implementations have different borrowing behavior of their captured variables. They should ideally both contribute to the coverage, since those MIR bodies are (*to the user*) the same code and should have no behavioral differences.

This PR at least suppresses the ICEs, and then I guess worst case we can fix this the right way later.

r? Zalathar or re-roll

Fixes rust-lang#131190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await Area: Async & Await A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) AsyncAwait-Triaged Async-await issues that have been triaged during a working group meeting. C-bug Category: This is a bug. F-async_closure `#![feature(async_closure)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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.

5 participants