rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.4k stars 12.73k forks source link

Failed to extract DefId: local_def_id_to_hir_id in src/dep_graph/dep_node.rs #99537

Open cryopie opened 2 years ago

cryopie commented 2 years ago

Not sure how to do a minimal verifiable example. It's a fairly trivial error in Diesel where I removed a field from the model and the SQL create table statement, but hadn't yet removed it in other locations in the code.

Meta

rustc --version --verbose:

rustc 1.60.0 (7737e0b5c 2022-04-04)
binary: rustc
commit-hash: 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c
commit-date: 2022-04-04
host: x86_64-unknown-linux-gnu
release: 1.60.0
LLVM version: 14.0.0

Error output

thread 'rustc' panicked at 'Failed to extract DefId: local_def_id_to_hir_id b85a9986cc30b1ad-d932eb1257b73404', compiler/rustc_middle/src/dep_graph/dep_node.rs:270:17
error: internal compiler error: unexpected panic
query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `diesel::query_builder::update_statement::UpdateStatement
[Redacted]
diesel::expression::bound::Bound<diesel::sql_types::Integer, i32>>>>: diesel::query_builder::AsQuery`
#1 [typeck] type-checking `...`
#2 [type_of] computing type of `...{opaque#0}`
#3 [check_mod_item_types] checking item types in module `...`
#4 [analysis] running analysis passes on this crate
end of query stack

I ran a cargo clean after which cargo build worked just fine. Can no longer reproduce the bug.

Backtrace

``` thread 'rustc' panicked at 'Failed to extract DefId: local_def_id_to_hir_id b85a9986cc30b1ad-d932eb1257b73404', compiler/rustc_middle/src/dep_graph/dep_node.rs:270:17 stack backtrace: 0: 0x7f10ea29786d - std::backtrace_rs::backtrace::libunwind::trace::hee598835bc88d35b at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7f10ea29786d - std::backtrace_rs::backtrace::trace_unsynchronized::h9cdc730ba5cf5d72 at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7f10ea29786d - std::sys_common::backtrace::_print_fmt::h75aeaf7ed30e43fa at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/sys_common/backtrace.rs:66:5 3: 0x7f10ea29786d - ::fmt::h606862f787600875 at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/sys_common/backtrace.rs:45:22 4: 0x7f10ea2f74ec - core::fmt::write::he803f0f418caf762 at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/fmt/mod.rs:1190:17 5: 0x7f10ea287a98 - std::io::Write::write_fmt::h70bc45872f37e7bb at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/io/mod.rs:1657:15 6: 0x7f10ea29b847 - std::sys_common::backtrace::_print::h64d038cf8ac3e13e at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/sys_common/backtrace.rs:48:5 7: 0x7f10ea29b847 - std::sys_common::backtrace::print::h359300b4a7fccf65 at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/sys_common/backtrace.rs:35:9 8: 0x7f10ea29b847 - std::panicking::default_hook::{{closure}}::hf51be35e2f510149 at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:295:22 9: 0x7f10ea29b510 - std::panicking::default_hook::h03ca0f22e1d2d25e at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:314:9 [Truncated] 117: 0x7f10ec374a66 - rustc_query_system[cf3d2502706fe991]::query::plumbing::try_execute_query::> 118: 0x7f10ece07963 - rustc_query_system[cf3d2502706fe991]::query::plumbing::get_query:: 119: 0x7f10ecbe9086 - ::for_each_module:: 120: 0x7f10ecbae118 - ::time::<(), rustc_typeck[1c3c3b5b5d734e80]::check_crate::{closure#6}> 121: 0x7f10ecba25c3 - rustc_typeck[1c3c3b5b5d734e80]::check_crate 122: 0x7f10ec93bed7 - rustc_interface[afc566840a941718]::passes::analysis 123: 0x7f10ece93b62 - >::with_task::> 124: 0x7f10ecee6303 - rustc_data_structures[762b64c8eff0c924]::stack::ensure_sufficient_stack::<(core[2734bb1f7d9ec6a5]::result::Result<(), rustc_errors[bd800fb2a5e0b9f5]::ErrorReported>, rustc_query_system[cf3d2502706fe991]::dep_graph::graph::DepNodeIndex), rustc_query_system[cf3d2502706fe99 1]::query::plumbing::execute_job>::{closure#3}> 125: 0x7f10ecdd5bae - rustc_query_system[cf3d2502706fe991]::query::plumbing::try_execute_query::>> 126: 0x7f10ece14c05 - rustc_query_system[cf3d2502706fe991]::query::plumbing::get_query:: 127: 0x7f10ec91a608 - ::enter::> 128: 0x7f10ec908ac5 - rustc_interface[afc566840a941718]::interface::create_compiler_and_run::, rustc_driver[6eeb127b85fe99ac]::run_compiler::{closure#1}> 129: 0x7f10ec8ee134 - std[cd3cf6af28dff6de]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver[6eeb127b85fe99ac]::run_compiler::{closure#1}>::{closure#0}, core[2734bb1f7d9ec6a5]::result::Result<(), rustc_errors[bd800fb2a5e0b9f5]::ErrorReported>>::{closure#0}, core[2734bb1f7d9ec6a5]::result::Result<(), rustc_errors[bd800fb2a5e0b9f5]::ErrorReported>> 130: 0x7f10ec9213e9 - <::spawn_unchecked_, rustc_driver[6eeb127b85fe99ac]::run_compiler::{closure#1}>::{closure#0}, core[2734bb1f7d9ec6a5]::result::Result<(), rustc_errors[bd800fb2a5e0b9f5]::ErrorReported>>::{closure#0}, core[2734bb1f7d9ec6a5]::result::Result<(), rustc_errors[bd800fb2a5e0b9f5]::ErrorReported>>::{closure#1} as c ore[2734bb1f7d9ec6a5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 131: 0x7f10ea2a7d03 - as core::ops::function::FnOnce>::call_once::hf70ac038171e3e1a at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/alloc/src/boxed.rs:1853:9 132: 0x7f10ea2a7d03 - as core::ops::function::FnOnce>::call_once::he6690128792365ad at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/alloc/src/boxed.rs:1853:9 133: 0x7f10ea2a7d03 - std::sys::unix::thread::Thread::new::thread_start::ha07928d93d5a5ec9 at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/sys/unix/thread.rs:108:17 134: 0x7f10e9e8c54d - 135: 0x7f10e9f11874 - clone 136: 0x0 - ```

steffahn commented 2 years ago

@rustbot label A-incr-comp

kpreid commented 10 months ago

Triage: Relabeling issues which don't have a runnable reproduction (as opposed to having a non-minimized one) to the new label S-needs-repro. @rustbot label +S-needs-repro -E-needs-mcve