Repository: rust
Issue: inlining produces broken MIR by changing whether types can be normalized
Labels: I-ICE,T-compiler,C-bug,A-mir-opt-inlining


### Meta

cargo +stable does not show this.

`rustc --version --verbose`:
```
rustc 1.72.0-nightly (101fa903b 2023-06-04)
```

### Error output

```
   Compiling rkyv v0.6.7
   Compiling plotters v0.3.4
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in Item(DefId(0:1502 ~ rkyv[9515]::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`
   --> /home/andy/.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_metadata::rmeta::encoder::encode_metadata
              13: rustc_metadata::fs::encode_and_write_metadata
              14: rustc_interface::passes::start_codegen
              15: <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>>
              16: <rustc_interface::queries::Queries>::ongoing_codegen
              17: <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>>
              18: 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}::{c
losure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
              19: <<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}
              20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                         at /rustc/101fa903bb9209d270086da279247625a2869211/library/alloc/src/boxed.rs:1985:9
              21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                         at /rustc/101fa903bb9209d270086da279247625a2869211/library/alloc/src/boxed.rs:1985:9
              22: std::sys::unix::thread::Thread::new::thread_start
                         at /rustc/101fa903bb9209d270086da279247625a2869211/library/std/src/sys/unix/thread.rs:108:17
              23: <unknown>
              24: <unknown>


error: internal compiler error: broken MIR in Item(DefId(0:1502 ~ rkyv[9515]::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`
   --> /home/andy/.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_metadata::rmeta::encoder::encode_metadata
              13: rustc_metadata::fs::encode_and_write_metadata
              14: rustc_interface::passes::start_codegen
              15: <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>>
              16: <rustc_interface::queries::Queries>::ongoing_codegen
              17: <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>>
              18: 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}::{c
losure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
              19: <<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}
              20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                         at /rustc/101fa903bb9209d270086da279247625a2869211/library/alloc/src/boxed.rs:1985:9
              21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                         at /rustc/101fa903bb9209d270086da279247625a2869211/library/alloc/src/boxed.rs:1985:9
              22: std::sys::unix::thread::Thread::new::thread_start
                         at /rustc/101fa903bb9209d270086da279247625a2869211/library/std/src/sys/unix/thread.rs:108:17
              23: <unknown>
              24: <unknown>


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.72.0-nightly (101fa903b 2023-06-04) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `rkyv` (lib)
warning: build failed, waiting for other jobs to finish...
```

</p>
</details>