Repository: rust
Issue: Failed to extract DefId: local_def_id_to_hir_id in src/dep_graph/dep_node.rs
Labels: I-ICE,T-compiler,A-incr-comp,C-bug,S-needs-repro

<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.

http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/

-->

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
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->
`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. 
<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
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 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::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::<rustc_query_impl[8218de0923c6cd45]::plumbing::QueryCtxt, rustc_query_system[cf3d2502706fe991]::query::caches::DefaultCache<rustc_span[4b4bb4534443c42f]::def_id::LocalDefId, ()>>
 118:     0x7f10ece07963 - rustc_query_system[cf3d2502706fe991]::query::plumbing::get_query::<rustc_query_impl[8218de0923c6cd45]::queries::check_mod_item_types, rustc_query_impl[8218de0923c6cd45]::plumbing::QueryCtxt>
 119:     0x7f10ecbe9086 - <rustc_middle[c145adf1c4567bf]::hir::map::Map>::for_each_module::<rustc_typeck[1c3c3b5b5d734e80]::check_crate::{closure#6}::{closure#0}>
 120:     0x7f10ecbae118 - <rustc_session[95a8f1c94d15e5dc]::session::Session>::time::<(), rustc_typeck[1c3c3b5b5d734e80]::check_crate::{closure#6}>
 121:     0x7f10ecba25c3 - rustc_typeck[1c3c3b5b5d734e80]::check_crate
 122:     0x7f10ec93bed7 - rustc_interface[afc566840a941718]::passes::analysis
 123:     0x7f10ece93b62 - <rustc_query_system[cf3d2502706fe991]::dep_graph::graph::DepGraph<rustc_middle[c145adf1c4567bf]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[c145adf1c4567bf]::ty::context::TyCtxt, (), core[2734bb1f7d9ec6a5]::result::Result<(), rustc_errors[bd800fb2a5e0b9f5]:
:ErrorReported>>
 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<rustc_query_impl[8218de0923c6cd45]::plumbing::QueryCtxt, (), core[2734bb1f7d9ec6a5]::result::Result<(), rustc_errors[bd800fb2a5e0b9f5]::ErrorReported>>::{closure#3}>
 125:     0x7f10ecdd5bae - rustc_query_system[cf3d2502706fe991]::query::plumbing::try_execute_query::<rustc_query_impl[8218de0923c6cd45]::plumbing::QueryCtxt, rustc_query_system[cf3d2502706fe991]::query::caches::DefaultCache<(), core[2734bb1f7d9ec6a5]::result::Result<(), rustc_errors[bd800fb2a5e0b
9f5]::ErrorReported>>>
 126:     0x7f10ece14c05 - rustc_query_system[cf3d2502706fe991]::query::plumbing::get_query::<rustc_query_impl[8218de0923c6cd45]::queries::analysis, rustc_query_impl[8218de0923c6cd45]::plumbing::QueryCtxt>
 127:     0x7f10ec91a608 - <rustc_interface[afc566840a941718]::passes::QueryContext>::enter::<rustc_driver[6eeb127b85fe99ac]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[2734bb1f7d9ec6a5]::result::Result<(), rustc_errors[bd800fb2a5e0b9f5]::ErrorReported>>
 128:     0x7f10ec908ac5 - rustc_interface[afc566840a941718]::interface::create_compiler_and_run::<core[2734bb1f7d9ec6a5]::result::Result<(), rustc_errors[bd800fb2a5e0b9f5]::ErrorReported>, rustc_driver[6eeb127b85fe99ac]::run_compiler::{closure#1}>
 129:     0x7f10ec8ee134 - std[cd3cf6af28dff6de]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[afc566840a941718]::util::run_in_thread_pool_with_globals<rustc_interface[afc566840a941718]::interface::run_compiler<core[2734bb1f7d9ec6a5]::result::Result<(), rustc_errors[bd800f
b2a5e0b9f5]::ErrorReported>, 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 - <<std[cd3cf6af28dff6de]::thread::Builder>::spawn_unchecked_<rustc_interface[afc566840a941718]::util::run_in_thread_pool_with_globals<rustc_interface[afc566840a941718]::interface::run_compiler<core[2734bb1f7d9ec6a5]::result::Result<(), rustc_errors[bd800fb2a5e0b9f5]::Erro
rReported>, 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 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf70ac038171e3e1a
                               at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/alloc/src/boxed.rs:1853:9
 132:     0x7f10ea2a7d03 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::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 - <unknown>
 135:     0x7f10e9f11874 - clone
 136:                0x0 - <unknown>
```

</p>
</details>