Skip to content

thread 'rustc' panicked at 'Failed to extract DefId: local_def_id_to_hir_id 72d14c2d4c75ac75-85fd0b3961a3c5c', compiler/rustc_middle/src/dep_graph/dep_node.rs:276:17 #99367

@yez730

Description

@yez730

Code

fn main(){
}

#[tracing::instrument]
fn trace() {
    // println!("1"); // Uncomment to complile successfully again when error occurs
}

// #[tracing::instrument]
// async fn trace_async() {
// }

Meta

rustc --version --verbose:

rustc 1.64.0-nightly (1c7b36d4d 2022-07-12)
binary: rustc
commit-hash: 1c7b36d4db582cb47513a6c7176baaec1c3346ab
commit-date: 2022-07-12
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6

Reproduce

  1. There is a regular fn and an async fn simultaneously
  2. Both fns have a procedure macro applied. here both #[tracing::instrument]

The condition for the error is to first uncomment the asynchronous function and the program can be successfully compiled(this makes sure later incremential comiplation based on that async fn), and then immediately comment out the asynchronous function to compile the program, and the following error will be displayed. Anything changed outside the async will make the compilation successful again.

Error output

Backtrace

thread 'rustc' panicked at 'Failed to extract DefId: local_def_id_to_hir_id 72d14c2d4c75ac75-85fd0b3961a3c5c', compiler/rustc_middle/src/dep_graph/dep_node.rs:276:17
stack backtrace:
   0:     0x7f12c96a27c0 - std::backtrace_rs::backtrace::libunwind::trace::hf2d478307f174bf8
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f12c96a27c0 - std::backtrace_rs::backtrace::trace_unsynchronized::h711075c80b4b15c0
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f12c96a27c0 - std::sys_common::backtrace::_print_fmt::hebeecd7b360baf82
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f12c96a27c0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h136680251e065964
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f12c96fbd9c - core::fmt::write::h21802877aced75ae
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/core/src/fmt/mod.rs:1198:17
   5:     0x7f12c9693f85 - std::io::Write::write_fmt::hfcde2a3cccecf969
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/std/src/io/mod.rs:1672:15
   6:     0x7f12c96a5451 - std::sys_common::backtrace::_print::h54991e5c3bc938cb
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f12c96a5451 - std::sys_common::backtrace::print::h9ca61c0ed4272627
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f12c96a5451 - std::panicking::default_hook::{{closure}}::h26c10b5c3b2bea64
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/std/src/panicking.rs:295:22
   9:     0x7f12c96a5123 - std::panicking::default_hook::hb3cbebc52bbac72e
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/std/src/panicking.rs:314:9
  10:     0x7f12c9f47a84 - rustc_driver[9f14ed6a3a961535]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f12c96a5c26 - std::panicking::rust_panic_with_hook::h0d09718c1ae4132d
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/std/src/panicking.rs:702:17
  12:     0x7f12c96a5a77 - std::panicking::begin_panic_handler::{{closure}}::h1010bf1f46fb8722
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/std/src/panicking.rs:588:13
  13:     0x7f12c96a2ca4 - std::sys_common::backtrace::__rust_end_short_backtrace::h60da120d1ee80789
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f12c96a57a2 - rust_begin_unwind
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/std/src/panicking.rs:584:5
  15:     0x7f12c9669ae3 - core::panicking::panic_fmt::h7c2f25a656c170f4
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/core/src/panicking.rs:142:14
  16:     0x7f12caf427a1 - <rustc_query_system[e4c1c7f3f0d73e2a]::dep_graph::dep_node::DepNode<rustc_middle[b8b7f3e9f324bba3]::dep_graph::dep_node::DepKind> as rustc_middle[b8b7f3e9f324bba3]::dep_graph::dep_node::DepNodeExt>::extract_def_id::{closure#0}
  17:     0x7f12cbf4cce9 - <rustc_query_system[e4c1c7f3f0d73e2a]::dep_graph::dep_node::DepNode<rustc_middle[b8b7f3e9f324bba3]::dep_graph::dep_node::DepKind> as rustc_middle[b8b7f3e9f324bba3]::dep_graph::dep_node::DepNodeExt>::extract_def_id
  18:     0x7f12cc622cdc - rustc_query_impl[43b94212d2512360]::query_callbacks::local_def_id_to_hir_id::force_from_dep_node
  19:     0x7f12cbfb50f1 - <rustc_middle[b8b7f3e9f324bba3]::ty::context::TyCtxt as rustc_query_system[e4c1c7f3f0d73e2a]::dep_graph::DepContext>::try_force_from_dep_node
  20:     0x7f12cba6653a - <rustc_query_system[e4c1c7f3f0d73e2a]::dep_graph::graph::DepGraph<rustc_middle[b8b7f3e9f324bba3]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[43b94212d2512360]::plumbing::QueryCtxt>
  21:     0x7f12cba65db6 - <rustc_query_system[e4c1c7f3f0d73e2a]::dep_graph::graph::DepGraph<rustc_middle[b8b7f3e9f324bba3]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[43b94212d2512360]::plumbing::QueryCtxt>
  22:     0x7f12cba65db6 - <rustc_query_system[e4c1c7f3f0d73e2a]::dep_graph::graph::DepGraph<rustc_middle[b8b7f3e9f324bba3]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[43b94212d2512360]::plumbing::QueryCtxt>
  23:     0x7f12cba65db6 - <rustc_query_system[e4c1c7f3f0d73e2a]::dep_graph::graph::DepGraph<rustc_middle[b8b7f3e9f324bba3]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[43b94212d2512360]::plumbing::QueryCtxt>
  24:     0x7f12cba65db6 - <rustc_query_system[e4c1c7f3f0d73e2a]::dep_graph::graph::DepGraph<rustc_middle[b8b7f3e9f324bba3]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[43b94212d2512360]::plumbing::QueryCtxt>
  25:     0x7f12cba65db6 - <rustc_query_system[e4c1c7f3f0d73e2a]::dep_graph::graph::DepGraph<rustc_middle[b8b7f3e9f324bba3]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[43b94212d2512360]::plumbing::QueryCtxt>
  26:     0x7f12cbad9ab1 - rustc_query_system[e4c1c7f3f0d73e2a]::query::plumbing::ensure_must_run::<rustc_query_impl[43b94212d2512360]::plumbing::QueryCtxt, rustc_span[b540c10ca4ad3e15]::def_id::LocalDefId, bool>
  27:     0x7f12cbad587e - <rustc_query_impl[43b94212d2512360]::Queries as rustc_middle[b8b7f3e9f324bba3]::ty::query::QueryEngine>::typeck
  28:     0x7f12cb5b3852 - <rustc_middle[b8b7f3e9f324bba3]::hir::map::Map>::par_body_owners::<rustc_typeck[e811e52da90d1343]::check::typeck_item_bodies::{closure#0}>
  29:     0x7f12cc38975c - rustc_typeck[e811e52da90d1343]::check::typeck_item_bodies
  30:     0x7f12cc5e1b49 - <rustc_query_system[e4c1c7f3f0d73e2a]::dep_graph::graph::DepGraph<rustc_middle[b8b7f3e9f324bba3]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[b8b7f3e9f324bba3]::ty::context::TyCtxt, (), ()>
  31:     0x7f12cc6837d5 - rustc_query_system[e4c1c7f3f0d73e2a]::query::plumbing::try_execute_query::<rustc_query_impl[43b94212d2512360]::plumbing::QueryCtxt, rustc_query_system[e4c1c7f3f0d73e2a]::query::caches::DefaultCache<(), ()>>
  32:     0x7f12cc6b65f1 - rustc_query_system[e4c1c7f3f0d73e2a]::query::plumbing::get_query::<rustc_query_impl[43b94212d2512360]::queries::typeck_item_bodies, rustc_query_impl[43b94212d2512360]::plumbing::QueryCtxt>
  33:     0x7f12cc393adf - <rustc_session[26041ce061f99353]::session::Session>::time::<(), rustc_typeck[e811e52da90d1343]::check_crate::{closure#7}>
  34:     0x7f12cc3eb5c7 - rustc_typeck[e811e52da90d1343]::check_crate
  35:     0x7f12cc114e07 - rustc_interface[dc3158545dad61e1]::passes::analysis
  36:     0x7f12cc5dc67c - <rustc_query_system[e4c1c7f3f0d73e2a]::dep_graph::graph::DepGraph<rustc_middle[b8b7f3e9f324bba3]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[b8b7f3e9f324bba3]::ty::context::TyCtxt, (), core[b41f5196d70b7330]::result::Result<(), rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>>
  37:     0x7f12cc679b9b - rustc_query_system[e4c1c7f3f0d73e2a]::query::plumbing::try_execute_query::<rustc_query_impl[43b94212d2512360]::plumbing::QueryCtxt, rustc_query_system[e4c1c7f3f0d73e2a]::query::caches::DefaultCache<(), core[b41f5196d70b7330]::result::Result<(), rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>>>
  38:     0x7f12cc6d7e5e - rustc_query_system[e4c1c7f3f0d73e2a]::query::plumbing::get_query::<rustc_query_impl[43b94212d2512360]::queries::analysis, rustc_query_impl[43b94212d2512360]::plumbing::QueryCtxt>
  39:     0x7f12cc0f841e - <rustc_interface[dc3158545dad61e1]::passes::QueryContext>::enter::<rustc_driver[9f14ed6a3a961535]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[b41f5196d70b7330]::result::Result<(), rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>>
  40:     0x7f12cc0dc26e - <rustc_interface[dc3158545dad61e1]::interface::Compiler>::enter::<rustc_driver[9f14ed6a3a961535]::run_compiler::{closure#1}::{closure#2}, core[b41f5196d70b7330]::result::Result<core[b41f5196d70b7330]::option::Option<rustc_interface[dc3158545dad61e1]::queries::Linker>, rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>>
  41:     0x7f12cc0d83bf - rustc_span[b540c10ca4ad3e15]::with_source_map::<core[b41f5196d70b7330]::result::Result<(), rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>, rustc_interface[dc3158545dad61e1]::interface::create_compiler_and_run<core[b41f5196d70b7330]::result::Result<(), rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>, rustc_driver[9f14ed6a3a961535]::run_compiler::{closure#1}>::{closure#1}>
  42:     0x7f12cc0f4510 - rustc_interface[dc3158545dad61e1]::interface::create_compiler_and_run::<core[b41f5196d70b7330]::result::Result<(), rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>, rustc_driver[9f14ed6a3a961535]::run_compiler::{closure#1}>
  43:     0x7f12cc108582 - <scoped_tls[69c5c7af7bad0e11]::ScopedKey<rustc_span[b540c10ca4ad3e15]::SessionGlobals>>::set::<rustc_interface[dc3158545dad61e1]::interface::run_compiler<core[b41f5196d70b7330]::result::Result<(), rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>, rustc_driver[9f14ed6a3a961535]::run_compiler::{closure#1}>::{closure#0}, core[b41f5196d70b7330]::result::Result<(), rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>>
  44:     0x7f12cc0da94f - std[aea08c340574f8b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[dc3158545dad61e1]::util::run_in_thread_pool_with_globals<rustc_interface[dc3158545dad61e1]::interface::run_compiler<core[b41f5196d70b7330]::result::Result<(), rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>, rustc_driver[9f14ed6a3a961535]::run_compiler::{closure#1}>::{closure#0}, core[b41f5196d70b7330]::result::Result<(), rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>>::{closure#0}, core[b41f5196d70b7330]::result::Result<(), rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>>
  45:     0x7f12cc0f4969 - <<std[aea08c340574f8b]::thread::Builder>::spawn_unchecked_<rustc_interface[dc3158545dad61e1]::util::run_in_thread_pool_with_globals<rustc_interface[dc3158545dad61e1]::interface::run_compiler<core[b41f5196d70b7330]::result::Result<(), rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>, rustc_driver[9f14ed6a3a961535]::run_compiler::{closure#1}>::{closure#0}, core[b41f5196d70b7330]::result::Result<(), rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>>::{closure#0}, core[b41f5196d70b7330]::result::Result<(), rustc_errors[b51a8ee25e0d94c9]::ErrorGuaranteed>>::{closure#1} as core[b41f5196d70b7330]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  46:     0x7f12c96af673 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h304119b3abe2df49
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/alloc/src/boxed.rs:1934:9
  47:     0x7f12c96af673 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2a0513e129c0d255
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/alloc/src/boxed.rs:1934:9
  48:     0x7f12c96af673 - std::sys::unix::thread::Thread::new::thread_start::h004b08da95a1ac4a
                               at /rustc/1c7b36d4db582cb47513a6c7176baaec1c3346ab/library/std/src/sys/unix/thread.rs:108:17
  49:     0x7f12c928c54d - <unknown>
  50:     0x7f12c9311874 - clone
  51:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: 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.64.0-nightly (1c7b36d4d 2022-07-12) running on x86_64-unknown-linux-gnu


note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental

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

query stack during panic:
#0 [typeck_item_bodies] type-checking all item bodies
#1 [analysis] running analysis passes on this crate
end of query stack

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