Skip to content

Compilation of rkyv (lib) is failing after upgrade to rust 1.71 #113781

Open
@pushkar85

Description

@pushkar85

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

<code>

Meta

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, 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>::call_once
at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/alloc/src/boxed.rs:1985:9
22: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::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, 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>::call_once
at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/alloc/src/boxed.rs:1985:9
22: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::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>
Backtrace

<backtrace>
``note: rustc 1.73.0-nightly (0e8e857b1 2023-07-16) running on x86_64-unknown-linux-gnu`


</p>
</details>

Activity

added
C-bugCategory: This is a bug.
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Jul 17, 2023
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Jul 17, 2023
lukas-code

lukas-code commented on Jul 17, 2023

@lukas-code
Member

duplicate of #112332

pushkar85

pushkar85 commented on Jul 17, 2023

@pushkar85
Author

@lukas-code is there any work around , currently its completely broken

lukas-code

lukas-code commented on Jul 17, 2023

@lukas-code
Member

The bug seems to be fixed in rkyv 0.7, so if you can upgrade that would probably be the best solution.

Otherwise, if you're stuck with rkyv 0.6, you can hack around this by disabling the buggy optimization pass by setting these environment variables:

RUSTC_BOOTSTRAP=1 RUSTFLAGS=-Zmir-enable-passes=-Inline

(Note that this enables unstable options on the stable compiler and isn't really supported.)

pushkar85

pushkar85 commented on Jul 17, 2023

@pushkar85
Author

Thanks a lot @lukas-code , for now it has worked

pushkar85

pushkar85 commented on Jul 18, 2023

@pushkar85
Author

@cjgillot by when we can expect this patch to be included in rust 1.71

pushkar85

pushkar85 commented on Jul 19, 2023

@pushkar85
Author

The bug seems to be fixed in rkyv 0.7, so if you can upgrade that would probably be the best solution.

Otherwise, if you're stuck with rkyv 0.6, you can hack around this by disabling the buggy optimization pass by setting these environment variables:

RUSTC_BOOTSTRAP=1 RUSTFLAGS=-Zmir-enable-passes=-Inline

(Note that this enables unstable options on the stable compiler and isn't really supported.)

@lukas-code This workaround does not work , when any optimisation level is set .

added a commit that references this issue on Jul 21, 2023

Auto merge of rust-lang#113802 - cjgillot:check-debuginfo, r=compiler…

removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @saethlin@lukas-code@rustbot@pushkar85

        Issue actions

          Compilation of `rkyv` (lib) is failing after upgrade to rust 1.71 · Issue #113781 · rust-lang/rust