Skip to content

ICE: Failed to extract DefId: opt_local_def_id_to_hir_id #114768

Open
@8051Enthusiast

Description

@8051Enthusiast

Code

Can be reproduced by first building (in debug mode) crates/yaboc-hir of https://github.com/8051enthusiast/yabo at commit 442536c09df2fe898bfeda81a2788bf9dce9dc19 after a cargo clean and then building at commit 5d5d795041d55d3bcbe21c5052807711dd307f13:

git clone https://github.com/8051enthusiast/yabo
cd yabo/crates/yaboc-hir
git checkout 442536c09df2fe898bfeda81a2788bf9dce9dc19
cargo clean
cargo build
git checkout 5d5d795041d55d3bcbe21c5052807711dd307f13
cargo build # ICE

diff: 8051Enthusiast/yabo@442536c...5d5d795

Meta

rustc --version --verbose:

rustc 1.73.0-nightly (a6f8aa5a0 2023-08-11)
binary: rustc
commit-hash: a6f8aa5a092c5e46fcbdafe4c80b4e55ba0de41c
commit-date: 2023-08-11
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 17.0.0

Also fails on stable.

Error output

Backtrace

thread 'rustc' panicked at compiler/rustc_middle/src/dep_graph/dep_node.rs:181:17:
Failed to extract DefId: opt_local_def_id_to_hir_id 11356bd1ee60cec5-ced77525c7774080
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a6f8aa5a092c5e46fcbdafe4c80b4e55ba0de41c/library/std/src/panicking.rs:617:5
   1: core::panicking::panic_fmt
             at /rustc/a6f8aa5a092c5e46fcbdafe4c80b4e55ba0de41c/library/core/src/panicking.rs:67:14
   2: <rustc_query_system::dep_graph::dep_node::DepNode<rustc_middle::dep_graph::dep_node::DepKind> as rustc_middle::dep_graph::dep_node::DepNodeExt>::extract_def_id::{closure#0}
   3: <rustc_query_system::dep_graph::dep_node::DepNode<rustc_middle::dep_graph::dep_node::DepKind> as rustc_middle::dep_graph::dep_node::DepNodeExt>::extract_def_id
   4: <rustc_query_impl::plumbing::query_callback<rustc_query_impl::query_impl::opt_local_def_id_to_hir_id::QueryType>::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_query_system::dep_graph::dep_node::DepNode<rustc_middle::dep_graph::dep_node::DepKind>)>>::call_once
   5: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
   6: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
   7: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
   8: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
   9: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  10: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  11: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  12: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  13: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  14: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  15: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  16: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::ParamEnvAnd<(rustc_middle::ty::instance::Instance, &rustc_middle::ty::list::List<rustc_middle::ty::Ty>)>, rustc_middle::query::erase::Erased<[u8; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
  17: rustc_codegen_llvm::callee::get_fn
  18: rustc_codegen_ssa::mir::codegen_mir::<rustc_codegen_llvm::builder::Builder>
  19: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
  20: <rustc_middle::dep_graph::dep_node::DepKind as rustc_query_system::dep_graph::DepKind>::with_deps::<<rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::with_task<rustc_middle::ty::context::TyCtxt, rustc_span::symbol::Symbol, rustc_codegen_ssa::ModuleCodegen<rustc_codegen_llvm::ModuleLlvm>>::{closure#0}::{closure#0}, rustc_codegen_ssa::ModuleCodegen<rustc_codegen_llvm::ModuleLlvm>>
  21: rustc_codegen_llvm::base::compile_codegen_unit
  22: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
  23: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  24: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
  25: rustc_interface::passes::start_codegen
  26: <rustc_middle::ty::context::GlobalCtxt>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_span::ErrorGuaranteed>>
  27: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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/name/programs/rust/yabo/rustc-ice-2023-08-13T01:26:59.209853937Z-135604.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C incremental=[REDACTED] -C link-arg=-fuse-ld=/usr/bin/mold

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

query stack during panic:
#0 [fn_abi_of_instance] computing call ABI of `core::ptr::drop_in_place::<salsa::derived::slot::PanicGuard<'_, HirNodeQuery, salsa::derived::AlwaysMemoizeValue>> - shim(Some(salsa::derived::slot::PanicGuard<'_, HirNodeQuery, salsa::derived::AlwaysMemoizeValue>))`
end of query stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 opt_def_kind(thread 'rustc' panicked at compiler/rustc_middle/src/dep_graph/dep_node.rs:181:17:
Failed to extract DefId: opt_def_kind 11356bd1ee60cec5-ced77525c7774080
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a6f8aa5a092c5e46fcbdafe4c80b4e55ba0de41c/library/std/src/panicking.rs:617:5
   1: core::panicking::panic_fmt
             at /rustc/a6f8aa5a092c5e46fcbdafe4c80b4e55ba0de41c/library/core/src/panicking.rs:67:14
   2: <rustc_query_system::dep_graph::dep_node::DepNode<rustc_middle::dep_graph::dep_node::DepKind> as rustc_middle::dep_graph::dep_node::DepNodeExt>::extract_def_id::{closure#0}
   3: <rustc_query_system::dep_graph::dep_node::DepNode<rustc_middle::dep_graph::dep_node::DepKind> as rustc_middle::dep_graph::dep_node::DepNodeExt>::extract_def_id
   4: <rustc_middle::dep_graph::dep_node::DepKind as rustc_query_system::dep_graph::DepKind>::debug_node
   5: core::fmt::rt::Argument::fmt
             at /rustc/a6f8aa5a092c5e46fcbdafe4c80b4e55ba0de41c/library/core/src/fmt/rt.rs:138:9
   6: core::fmt::write
             at /rustc/a6f8aa5a092c5e46fcbdafe4c80b4e55ba0de41c/library/core/src/fmt/mod.rs:1094:21
   7: std::io::Write::write_fmt
             at /rustc/a6f8aa5a092c5e46fcbdafe4c80b4e55ba0de41c/library/std/src/io/mod.rs:1714:15
   8: <&std::io::stdio::Stderr as std::io::Write>::write_fmt
             at /rustc/a6f8aa5a092c5e46fcbdafe4c80b4e55ba0de41c/library/std/src/io/stdio.rs:945:9
   9: <std::io::stdio::Stderr as std::io::Write>::write_fmt
             at /rustc/a6f8aa5a092c5e46fcbdafe4c80b4e55ba0de41c/library/std/src/io/stdio.rs:919:9
  10: std::io::stdio::print_to
             at /rustc/a6f8aa5a092c5e46fcbdafe4c80b4e55ba0de41c/library/std/src/io/stdio.rs:1018:21
  11: std::io::stdio::_eprint
             at /rustc/a6f8aa5a092c5e46fcbdafe4c80b4e55ba0de41c/library/std/src/io/stdio.rs:1106:5
  12: rustc_query_system::dep_graph::graph::print_markframe_trace::<rustc_middle::dep_graph::dep_node::DepKind>
  13: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  14: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  15: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  16: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  17: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  18: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  19: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  20: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  21: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  22: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  23: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  24: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::ParamEnvAnd<(rustc_middle::ty::instance::Instance, &rustc_middle::ty::list::List<rustc_middle::ty::Ty>)>, rustc_middle::query::erase::Erased<[u8; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
  25: rustc_codegen_llvm::callee::get_fn
  26: rustc_codegen_ssa::mir::codegen_mir::<rustc_codegen_llvm::builder::Builder>
  27: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
  28: <rustc_middle::dep_graph::dep_node::DepKind as rustc_query_system::dep_graph::DepKind>::with_deps::<<rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::with_task<rustc_middle::ty::context::TyCtxt, rustc_span::symbol::Symbol, rustc_codegen_ssa::ModuleCodegen<rustc_codegen_llvm::ModuleLlvm>>::{closure#0}::{closure#0}, rustc_codegen_ssa::ModuleCodegen<rustc_codegen_llvm::ModuleLlvm>>
  29: rustc_codegen_llvm::base::compile_codegen_unit
  30: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
  31: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  32: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
  33: rustc_interface::passes::start_codegen
  34: <rustc_middle::ty::context::GlobalCtxt>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_span::ErrorGuaranteed>>
  35: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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/name/programs/rust/yabo/rustc-ice-2023-08-13T01:26:59.209853937Z-135604.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C incremental=[REDACTED] -C link-arg=-fuse-ld=/usr/bin/mold

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

query stack during panic:
#0 [fn_abi_of_instance] computing call ABI of `core::ptr::drop_in_place::<salsa::derived::slot::PanicGuard<'_, HirNodeQuery, salsa::derived::AlwaysMemoizeValue>> - shim(Some(salsa::derived::slot::PanicGuard<'_, HirNodeQuery, salsa::derived::AlwaysMemoizeValue>))`
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-incr-compArea: Incremental compilationC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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