Repository: rust
Issue: failure building rust-analyzer with `RUSTFLAGS='-C target-cpu=native'`
Labels: I-ICE,T-compiler,C-bug

<!--
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/
-->

### Code

```Rust
master branch of rust-analyzer 7f01ae877dfd26277a52630c9e40724db23ff8fc
```


### 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.67.1 (d5a82bbd2 2023-02-07)
binary: rustc
commit-hash: d5a82bbd26e1ad8b7401f6a718a9c57c96905483
commit-date: 2023-02-07
host: x86_64-unknown-linux-gnu
release: 1.67.1
LLVM version: 15.0.6
```

### Error output

```
query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `salsa::derived::slot::Memo<hir_ty::db::ConstEvalQuery>: core::marker::Send`
#1 [check_well_formed] checking that `<impl at crates/ide-db/src/lib.rs:155:1: 155:46>` is well-formed
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `ide-db`
warning: build failed, waiting for other jobs to finish...
thread 'rustc' panicked at 'Failed to extract DefId: local_def_id_to_hir_id 7c6b92b1277d31f-1812b2e5d3b52555', compiler/rustc_middle/src/dep_graph/dep_node.rs:181:17
stack backtrace:
   0:     0x7fa4ef1656fa - std::backtrace_rs::backtrace::libunwind::trace::h79937bc171ada62c
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fa4ef1656fa - std::backtrace_rs::backtrace::trace_unsynchronized::h2292bca8571cb919
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fa4ef1656fa - std::sys_common::backtrace::_print_fmt::h9c461f248e4ae90d
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fa4ef1656fa - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he9fe6bf1a39182e1
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fa4ef1c825e - core::fmt::write::h032658c119c720d7
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/fmt/mod.rs:1208:17
   5:     0x7fa4ef155a85 - std::io::Write::write_fmt::h299fc90dfae41c0d
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/io/mod.rs:1682:15
   6:     0x7fa4ef1654c5 - std::sys_common::backtrace::_print::heb70d25df9937e3f
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fa4ef1654c5 - std::sys_common::backtrace::print::had745c0a76b8b521
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fa4ef16820f - std::panicking::default_hook::{{closure}}::h1ea782cdfa2fd097
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:267:22
   9:     0x7fa4ef167f4b - std::panicking::default_hook::h1cc3af63455a163c
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:286:9
  10:     0x7fa4f2460ab1 - <rustc_driver[5c3b90d1fb3964ba]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[e6a29f2585b3d454]::ops::function::FnOnce<(&core[e6a29f2585b3d454]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7fa4ef168a4d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h6e4950ba7c0fd82a
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/alloc/src/boxed.rs:2032:9
  12:     0x7fa4ef168a4d - std::panicking::rust_panic_with_hook::h5cafdc4b3bfd5528
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:692:13
  13:     0x7fa4ef1687c9 - std::panicking::begin_panic_handler::{{closure}}::hf31c60f40775892c
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:579:13
  14:     0x7fa4ef165bac - std::sys_common::backtrace::__rust_end_short_backtrace::h28a5c7be595826cd
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:137:18
  15:     0x7fa4ef1684d2 - rust_begin_unwind
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:575:5
  16:     0x7fa4ef1c4c43 - core::panicking::panic_fmt::h8fa27a0b37dd98b7
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/panicking.rs:64:14
  17:     0x7fa4f28d5612 - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::dep_node::DepNode<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind> as rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepNodeExt>::extract_def_id::{closure#0}
  18:     0x7fa4f0454630 - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::dep_node::DepNode<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind> as rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepNodeExt>::extract_def_id
  19:     0x7fa4f1a34a0c - rustc_query_impl[e214cefb6de2a99d]::plumbing::force_from_dep_node::<rustc_query_impl[e214cefb6de2a99d]::queries::local_def_id_to_hir_id>
  20:     0x7fa4f04bb039 - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  21:     0x7fa4f04bafdc - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  22:     0x7fa4f04bafdc - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  23:     0x7fa4f04bafdc - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  24:     0x7fa4f04bafdc - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  25:     0x7fa4f04bafdc - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  26:     0x7fa4f04bafdc - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  27:     0x7fa4f04bafdc - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  28:     0x7fa4f0afc0a2 - rustc_query_system[7dbbccfee5a2d054]::query::plumbing::try_execute_query::<rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt, rustc_query_system[7dbbccfee5a2d054]::query::caches::DefaultCache<rustc_middle[83f907612b22699d]::ty::ParamEnvAnd<rustc_middle[83f907612b22699d]::ty::Ty>, bool>>
  29:     0x7fa4f14d6346 - rustc_query_system[7dbbccfee5a2d054]::query::plumbing::get_query::<rustc_query_impl[e214cefb6de2a99d]::queries::is_unpin_raw, rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  30:     0x7fa4f0758805 - <rustc_middle[83f907612b22699d]::ty::Ty>::is_unpin
  31:     0x7fa4f0757255 - <rustc_middle[83f907612b22699d]::ty::Ty as rustc_target[8231a83a27903a6f]::abi::TyAbiInterface<rustc_middle[83f907612b22699d]::ty::layout::LayoutCx<rustc_middle[83f907612b22699d]::ty::context::TyCtxt>>>::ty_and_layout_pointee_info_at
  32:     0x7fa4f0753bc8 - <core[e6a29f2585b3d454]::iter::adapters::GenericShunt<core[e6a29f2585b3d454]::iter::adapters::map::Map<core[e6a29f2585b3d454]::iter::adapters::enumerate::Enumerate<core[e6a29f2585b3d454]::iter::adapters::chain::Chain<core[e6a29f2585b3d454]::iter::adapters::chain::Chain<core[e6a29f2585b3d454]::iter::adapters::copied::Copied<core[e6a29f2585b3d454]::slice::iter::Iter<rustc_middle[83f907612b22699d]::ty::Ty>>, core[e6a29f2585b3d454]::iter::adapters::copied::Copied<core[e6a29f2585b3d454]::slice::iter::Iter<rustc_middle[83f907612b22699d]::ty::Ty>>>, core[e6a29f2585b3d454]::option::IntoIter<rustc_middle[83f907612b22699d]::ty::Ty>>>, rustc_ty_utils[34c822c6223252eb]::abi::fn_abi_new_uncached::{closure#1}>, core[e6a29f2585b3d454]::result::Result<core[e6a29f2585b3d454]::convert::Infallible, rustc_middle[83f907612b22699d]::ty::layout::FnAbiError>> as core[e6a29f2585b3d454]::iter::traits::iterator::Iterator>::next
  33:     0x7fa4f03f089a - rustc_ty_utils[34c822c6223252eb]::abi::fn_abi_new_uncached
  34:     0x7fa4f03eb043 - rustc_ty_utils[34c822c6223252eb]::abi::fn_abi_of_instance
  35:     0x7fa4f0f8f4dd - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[83f907612b22699d]::ty::context::TyCtxt, rustc_middle[83f907612b22699d]::ty::ParamEnvAnd<(rustc_middle[83f907612b22699d]::ty::instance::Instance, &rustc_middle[83f907612b22699d]::ty::list::List<rustc_middle[83f907612b22699d]::ty::Ty>)>, core[e6a29f2585b3d454]::result::Result<&rustc_target[8231a83a27903a6f]::abi::call::FnAbi<rustc_middle[83f907612b22699d]::ty::Ty>, rustc_middle[83f907612b22699d]::ty::layout::FnAbiError>>
  36:     0x7fa4f0f8ce70 - rustc_query_system[7dbbccfee5a2d054]::query::plumbing::get_query::<rustc_query_impl[e214cefb6de2a99d]::queries::fn_abi_of_instance, rustc_query_impl[e214cefb6de2a99d]::plumbing::QueryCtxt>
  37:     0x7fa4f09ce87b - <rustc_codegen_llvm[c898f894c35cc94c]::context::CodegenCx as rustc_codegen_ssa[8f170ea7f7f17057]::traits::declare::PreDefineMethods>::predefine_fn
  38:     0x7fa4f190e33c - rustc_codegen_llvm[c898f894c35cc94c]::base::compile_codegen_unit::module_codegen
  39:     0x7fa4f1aea437 - <rustc_query_system[7dbbccfee5a2d054]::dep_graph::graph::DepGraph<rustc_middle[83f907612b22699d]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[83f907612b22699d]::ty::context::TyCtxt, rustc_span[41a321a6411ba4fa]::symbol::Symbol, rustc_codegen_ssa[8f170ea7f7f17057]::ModuleCodegen<rustc_codegen_llvm[c898f894c35cc94c]::ModuleLlvm>>
  40:     0x7fa4f1aea007 - <rustc_codegen_llvm[c898f894c35cc94c]::LlvmCodegenBackend as rustc_codegen_ssa[8f170ea7f7f17057]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
  41:     0x7fa4f1ae7a53 - rustc_codegen_ssa[8f170ea7f7f17057]::base::codegen_crate::<rustc_codegen_llvm[c898f894c35cc94c]::LlvmCodegenBackend>
  42:     0x7fa4f1ae71f9 - <rustc_codegen_llvm[c898f894c35cc94c]::LlvmCodegenBackend as rustc_codegen_ssa[8f170ea7f7f17057]::traits::backend::CodegenBackend>::codegen_crate
  43:     0x7fa4f16263c1 - <rustc_session[b89b9f24749004e7]::session::Session>::time::<alloc[89959c1738bdde42]::boxed::Box<dyn core[e6a29f2585b3d454]::any::Any>, rustc_interface[65dcc5dffb099e04]::passes::start_codegen::{closure#0}>
  44:     0x7fa4f1625ee9 - rustc_interface[65dcc5dffb099e04]::passes::start_codegen
  45:     0x7fa4f1623bc6 - <rustc_interface[65dcc5dffb099e04]::passes::QueryContext>::enter::<<rustc_interface[65dcc5dffb099e04]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[e6a29f2585b3d454]::result::Result<alloc[89959c1738bdde42]::boxed::Box<dyn core[e6a29f2585b3d454]::any::Any>, rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>
  46:     0x7fa4f162109a - <rustc_interface[65dcc5dffb099e04]::queries::Queries>::ongoing_codegen
  47:     0x7fa4f1620767 - <rustc_interface[65dcc5dffb099e04]::interface::Compiler>::enter::<rustc_driver[5c3b90d1fb3964ba]::run_compiler::{closure#1}::{closure#2}, core[e6a29f2585b3d454]::result::Result<core[e6a29f2585b3d454]::option::Option<rustc_interface[65dcc5dffb099e04]::queries::Linker>, rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>
  48:     0x7fa4f161b788 - rustc_span[41a321a6411ba4fa]::with_source_map::<core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>, rustc_interface[65dcc5dffb099e04]::interface::run_compiler<core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>, rustc_driver[5c3b90d1fb3964ba]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  49:     0x7fa4f161b275 - <scoped_tls[393dd8f8fd825c8d]::ScopedKey<rustc_span[41a321a6411ba4fa]::SessionGlobals>>::set::<rustc_interface[65dcc5dffb099e04]::interface::run_compiler<core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>, rustc_driver[5c3b90d1fb3964ba]::run_compiler::{closure#1}>::{closure#0}, core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>
  50:     0x7fa4f161a862 - std[359ab902947f5f0b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[65dcc5dffb099e04]::util::run_in_thread_pool_with_globals<rustc_interface[65dcc5dffb099e04]::interface::run_compiler<core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>, rustc_driver[5c3b90d1fb3964ba]::run_compiler::{closure#1}>::{closure#0}, core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>
  51:     0x7fa4f1d13b7a - <<std[359ab902947f5f0b]::thread::Builder>::spawn_unchecked_<rustc_interface[65dcc5dffb099e04]::util::run_in_thread_pool_with_globals<rustc_interface[65dcc5dffb099e04]::interface::run_compiler<core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>, rustc_driver[5c3b90d1fb3964ba]::run_compiler::{closure#1}>::{closure#0}, core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e6a29f2585b3d454]::result::Result<(), rustc_errors[d24ea2395205e4f0]::ErrorGuaranteed>>::{closure#1} as core[e6a29f2585b3d454]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  52:     0x7fa4ef172803 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb77d8d72ebcf79c4
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/alloc/src/boxed.rs:2000:9
  53:     0x7fa4ef172803 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc08c3353e1568487
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/alloc/src/boxed.rs:2000:9
  54:     0x7fa4ef172803 - std::sys::unix::thread::Thread::new::thread_start::h7168e596cd5e5ce6
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys/unix/thread.rs:108:17
  55:     0x7fa4eef04bb5 - <unknown>
  56:     0x7fa4eef86d90 - <unknown>
  57:                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.67.1 (d5a82bbd2 2023-02-07) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [is_unpin_raw] computing whether `core::option::Option<salsa::derived::slot::Memo<db::ConstEvalQuery>>` is `Unpin`
#1 [fn_abi_of_instance] computing call ABI of `core::mem::replace::<core::option::Option<salsa::derived::slot::Memo<db::ConstEvalQuery>>>`
end of query stack
error: could not compile `hir-ty`
error: failed to compile `rust-analyzer v0.0.0 (/home/yangdonglin/code/rust-analyzer/crates/rust-analyzer)`, intermediate artifacts can be found at `/home/yangdonglin/code/rust-analyzer/target`
Error: install server

Caused by:
    command exited with non-zero code `cargo install --path crates/rust-analyzer --locked --force --features force-always-assert --features jemalloc`: 101
```

<!--
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>

```
<backtrace>
```

</p>
</details>