Repository: rust
Issue: Compilation of  `rkyv` (lib) is failing after upgrade to rust 1.71
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/
-->

### error: internal compiler error: no errors encountered even though `delay_span_bug` issued
error: internal compiler error: broken MIR in Item(DefId(0:1705 ~ rkyv[d260]::std_impl::{impl#47}::deserialize)) (after phase change to runtime-optimized) at bb0[22]:
                                Field projection `PlaceRef { local: _1, projection: [Deref, Field(0, RelPtr<[<T as Archive>::Archived]>)] }.1` specified type `u32`, but actual type is `<[<T as Archive>::Archived] as ArchivePointee>::ArchivedMetadata`
   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rkyv-0.6.7/src/core_impl/mod.rs:489:9

```Rust
<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.71.0 (8ede3aae2 2023-07-12) running on x86_64-unknown-linux-gnu
```

### Error output
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
error: internal compiler error: broken MIR in Item(DefId(0:1705 ~ rkyv[14fb]::std_impl::{impl#47}::deserialize)) (after phase change to runtime-optimized) at bb0[27]:
                                Field projection `(*_19).1` specified type `u32`, but actual type is `<[<T as Archive>::Archived] as ArchivePointee>::ArchivedMetadata`
   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rkyv-0.6.7/src/lib.rs:765:77
    |
765 |         ptr_meta::from_raw_parts(self.raw_ptr.as_ptr(), T::pointer_metadata(&self.metadata))
    |                                                                             ^^^^^^^^^^^^^^
    |
    = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:354:30
               0: <rustc_errors::HandlerInner>::emit_diagnostic
               1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
               2: <rustc_const_eval::transform::validate::TypeChecker>::fail::<alloc::string::String>
               3: <rustc_const_eval::transform::validate::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_place
               4: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
               5: rustc_mir_transform::optimized_mir
               6: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
               7: <rustc_query_impl::query_impl::optimized_mir::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once
               8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
               9: rustc_query_impl::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
              10: <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root
              11: rustc_metadata::rmeta::encoder::encode_metadata_impl
              12: rustc_data_structures::sync::join::<rustc_metadata::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}, (), ()>
              13: rustc_metadata::rmeta::encoder::encode_metadata
              14: rustc_metadata::fs::encode_and_write_metadata
              15: rustc_interface::passes::start_codegen
              16: <rustc_middle::ty::context::GlobalCtxt>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_span::ErrorGuaranteed>>
              17: <rustc_interface::queries::Queries>::ongoing_codegen
              18: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
              19: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
              20: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
              21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                         at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/alloc/src/boxed.rs:1985:9
              22: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                         at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/alloc/src/boxed.rs:1985:9
              23: std::sys::unix::thread::Thread::new::thread_start
                         at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/sys/unix/thread.rs:108:17
              24: start_thread
              25: __clone
            
error: internal compiler error: broken MIR in Item(DefId(0:1705 ~ rkyv[14fb]::std_impl::{impl#47}::deserialize)) (after phase change to runtime-optimized) at bb3[29]:
                                Field projection `(*_37).1` specified type `u32`, but actual type is `<[<T as Archive>::Archived] as ArchivePointee>::ArchivedMetadata`
   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rkyv-0.6.7/src/lib.rs:765:77
    |
765 |         ptr_meta::from_raw_parts(self.raw_ptr.as_ptr(), T::pointer_metadata(&self.metadata))
    |                                                                             ^^^^^^^^^^^^^^
    |
    = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:354:30
               0: <rustc_errors::HandlerInner>::emit_diagnostic
               1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
               2: <rustc_const_eval::transform::validate::TypeChecker>::fail::<alloc::string::String>
               3: <rustc_const_eval::transform::validate::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_place
               4: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
               5: rustc_mir_transform::optimized_mir
               6: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
               7: <rustc_query_impl::query_impl::optimized_mir::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once
               8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
               9: rustc_query_impl::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
              10: <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root
              11: rustc_metadata::rmeta::encoder::encode_metadata_impl
              12: rustc_data_structures::sync::join::<rustc_metadata::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}, (), ()>
              13: rustc_metadata::rmeta::encoder::encode_metadata
              14: rustc_metadata::fs::encode_and_write_metadata
              15: rustc_interface::passes::start_codegen
              16: <rustc_middle::ty::context::GlobalCtxt>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_span::ErrorGuaranteed>>
              17: <rustc_interface::queries::Queries>::ongoing_codegen
              18: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
              19: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
              20: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
              21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                         at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/alloc/src/boxed.rs:1985:9
              22: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                         at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/alloc/src/boxed.rs:1985:9
              23: std::sys::unix::thread::Thread::new::thread_start
                         at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/sys/unix/thread.rs:108:17
              24: start_thread
              25: __clone
```
<output>
```

<!--
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>
``note: rustc 1.73.0-nightly (0e8e857b1 2023-07-16) running on x86_64-unknown-linux-gnu`


</p>
</details>