Skip to content

ICE: assertion failed: dead_codes.iter().skip(1).all(|id|.... #119267

Closed

Description

@matthiaskrgr

snippet:

#[derive(Debug)]
struct Foo(i32);

#[derive(Debug)]
struct ConstainsDropField(Foo, #[allow(unused)] Foo);

Version information

rustc 1.77.0-nightly (2d7be7393 2023-12-23)
binary: rustc
commit-hash: 2d7be73931e0978c8758a672cc7258b417a7e999
commit-date: 2023-12-23
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --crate-type=lib -Z dump-mir-dir=dir

Program output

thread 'rustc' panicked at compiler/rustc_passes/src/dead.rs:810:9:
assertion failed: dead_codes.iter().skip(1).all(|id|
        {
            let hir_id = tcx.local_def_id_to_hir_id(*id);
            let level =
                tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir_id).0;
            level == first_lint_level
        })
stack backtrace:
   0:     0x7ff1353fb6f6 - std::backtrace_rs::backtrace::libunwind::trace::h854d9901466ba2a6
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7ff1353fb6f6 - std::backtrace_rs::backtrace::trace_unsynchronized::h2e5473e1358f3d7d
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ff1353fb6f6 - std::sys_common::backtrace::_print_fmt::h17999543628ef5b9
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7ff1353fb6f6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd4a315f9d82cb167
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ff13544df40 - core::fmt::rt::Argument::fmt::h61d1362a4781e5b2
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/core/src/fmt/rt.rs:142:9
   5:     0x7ff13544df40 - core::fmt::write::hdd3124965f70515e
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/core/src/fmt/mod.rs:1120:17
   6:     0x7ff1353ef53f - std::io::Write::write_fmt::hf681a4235a84103e
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/io/mod.rs:1810:15
   7:     0x7ff1353fb4d4 - std::sys_common::backtrace::_print::hf875b2182006ee31
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7ff1353fb4d4 - std::sys_common::backtrace::print::h6091516d06acaa34
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7ff1353fe267 - std::panicking::default_hook::{{closure}}::h7008dc256987fa65
  10:     0x7ff1353fdfc9 - std::panicking::default_hook::he81ec00845e2991e
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/panicking.rs:292:9
  11:     0x7ff13215adec - std[76579cbcf5e75e71]::panicking::update_hook::<alloc[b53221f29dc7d1be]::boxed::Box<rustc_driver_impl[5725e9f2ae9a40a2]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7ff1353fe9b6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hfccb34defa5e1891
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/alloc/src/boxed.rs:2029:9
  13:     0x7ff1353fe9b6 - std::panicking::rust_panic_with_hook::ha947ff64165fedb2
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/panicking.rs:783:13
  14:     0x7ff1353fe6c9 - std::panicking::begin_panic_handler::{{closure}}::h7f336a84c52547b7
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/panicking.rs:649:13
  15:     0x7ff1353fbbf6 - std::sys_common::backtrace::__rust_end_short_backtrace::h26cdeb6403f48183
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7ff1353fe460 - rust_begin_unwind
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/panicking.rs:645:5
  17:     0x7ff13544a645 - core::panicking::panic_fmt::h6ec837525499bcbc
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/core/src/panicking.rs:72:14
  18:     0x7ff13544a703 - core::panicking::panic::hcb6de605faec2bad
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/core/src/panicking.rs:144:5
  19:     0x7ff1337e39a3 - <rustc_passes[c95769a7eb953e08]::dead::DeadVisitor>::lint_at_single_level
  20:     0x7ff133df0e88 - <rustc_passes[c95769a7eb953e08]::dead::DeadVisitor>::warn_multiple
  21:     0x7ff1339a3d26 - rustc_passes[c95769a7eb953e08]::dead::check_mod_deathness
  22:     0x7ff1339a35a3 - rustc_query_impl[d4cc752ff0d73f28]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d4cc752ff0d73f28]::query_impl::check_mod_deathness::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3892716d31dc4121]::query::erase::Erased<[u8; 0usize]>>
  23:     0x7ff13404b1bb - rustc_query_system[d117b86e449fcdf2]::query::plumbing::try_execute_query::<rustc_query_impl[d4cc752ff0d73f28]::DynamicConfig<rustc_query_system[d117b86e449fcdf2]::query::caches::DefaultCache<rustc_span[d159d62802098cb3]::def_id::LocalModDefId, rustc_middle[3892716d31dc4121]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[d4cc752ff0d73f28]::plumbing::QueryCtxt, false>
  24:     0x7ff13404c203 - rustc_query_impl[d4cc752ff0d73f28]::query_impl::check_mod_deathness::get_query_non_incr::__rust_end_short_backtrace
  25:     0x7ff133bee128 - rustc_interface[1da9c7dc31a5385c]::passes::analysis
  26:     0x7ff133becf9d - rustc_query_impl[d4cc752ff0d73f28]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d4cc752ff0d73f28]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3892716d31dc4121]::query::erase::Erased<[u8; 1usize]>>
  27:     0x7ff13430f940 - rustc_query_system[d117b86e449fcdf2]::query::plumbing::try_execute_query::<rustc_query_impl[d4cc752ff0d73f28]::DynamicConfig<rustc_query_system[d117b86e449fcdf2]::query::caches::SingleCache<rustc_middle[3892716d31dc4121]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d4cc752ff0d73f28]::plumbing::QueryCtxt, false>
  28:     0x7ff13430f747 - rustc_query_impl[d4cc752ff0d73f28]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7ff1343a8b12 - rustc_interface[1da9c7dc31a5385c]::interface::run_compiler::<core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>, rustc_driver_impl[5725e9f2ae9a40a2]::run_compiler::{closure#0}>::{closure#0}
  30:     0x7ff13432b486 - std[76579cbcf5e75e71]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[1da9c7dc31a5385c]::util::run_in_thread_with_globals<rustc_interface[1da9c7dc31a5385c]::util::run_in_thread_pool_with_globals<rustc_interface[1da9c7dc31a5385c]::interface::run_compiler<core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>, rustc_driver_impl[5725e9f2ae9a40a2]::run_compiler::{closure#0}>::{closure#0}, core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>>::{closure#0}, core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>>
  31:     0x7ff13432b2b3 - <<std[76579cbcf5e75e71]::thread::Builder>::spawn_unchecked_<rustc_interface[1da9c7dc31a5385c]::util::run_in_thread_with_globals<rustc_interface[1da9c7dc31a5385c]::util::run_in_thread_pool_with_globals<rustc_interface[1da9c7dc31a5385c]::interface::run_compiler<core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>, rustc_driver_impl[5725e9f2ae9a40a2]::run_compiler::{closure#0}>::{closure#0}, core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>>::{closure#0}, core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[730ecc411c8eaf02]::result::Result<(), rustc_span[d159d62802098cb3]::ErrorGuaranteed>>::{closure#1} as core[730ecc411c8eaf02]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x7ff1354088e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hca712a7e6055e033
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/alloc/src/boxed.rs:2015:9
  33:     0x7ff1354088e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0c4d9df2b2c66b37
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/alloc/src/boxed.rs:2015:9
  34:     0x7ff1354088e5 - std::sys::unix::thread::Thread::new::thread_start::h42e6b966712cbe95
                               at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/sys/unix/thread.rs:108:17
  35:     0x7ff12f2aa9eb - <unknown>
  36:     0x7ff12f32e7cc - <unknown>
  37:                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: rustc 1.77.0-nightly (2d7be7393 2023-12-23) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -Z dump-mir-dir=dir

query stack during panic:
#0 [check_mod_deathness] checking deathness of variables in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack

Activity

  1. added
    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.
    C-bugCategory: This is a bug.
    on Dec 23, 2023
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Dec 23, 2023
  3. changed the title [-]ICE: `assertion failed: dead_codes.iter().skip(1).all(|id|....[/-] [+]ICE: `assertion failed: dead_codes.iter().skip(1).all(|id|....`[/+] on Dec 23, 2023
  4. matthiaskrgr commented on Dec 24, 2023

    @matthiaskrgr
    MemberAuthor

    Regression in #114417

  5. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Dec 24, 2023
  6. mu001999 commented on Dec 24, 2023

    @mu001999
    Member

    This seems to be fixed by #118297

  7. added a commit that references this issue on Dec 25, 2023
  8. added a commit that references this issue on Dec 26, 2023
  9. added a commit that references this issue on Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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