Skip to content

no errors encountered even though delay_span_bug issued #107691

Closed
@winterqt

Description

@winterqt

The notable difference between this issue and others like it (#107684, #107678, #107686) are that this is happening in 1.67.0 (where the others have it in nightly), and in release mode (where at least one of them only happens in debug mode). Posting this as a separate ticket given these reasons, I hope that's okay.

Code

use rkyv::{
    with::{CopyOptimize, RefAsBox},
    Archive, Serialize,
};

#[derive(Archive, Serialize, Debug)]
pub struct Record<'a> {
    #[with(CopyOptimize, RefAsBox)]
    payload: &'a [u8],
}

(Tested with rkyv v0.7.39)

This only happens when building in release mode.

Meta

rustc --version --verbose:

rustc 1.67.0 (fc594f156 2023-01-24) (built from a source tarball)
binary: rustc
commit-hash: fc594f15669680fa70d255faec3ca3fb507c3405
commit-date: 2023-01-24
host: aarch64-apple-darwin
release: 1.67.0
LLVM version: 15.0.7

Error output

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:27 ~ ice_repro[7457]::_::{impl#0}::resolve), const_param_did: None }) (after phase change to runtime-optimized) at bb0[2]:
                                Field projection `(*_4).field[0]` specified type `rkyv::boxed::ArchivedBox<[u8]>`, but actual type is `<rkyv::with::With<rkyv::with::With<&[u8], rkyv::with::RefAsBox>, rkyv::with::CopyOptimize> as rkyv::Archive>::Archived`
 --> src/lib.rs:6:10
  |
6 | #[derive(Archive, Serialize, Debug)]
  |          ^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:233:30
  = note: this error: internal compiler error originates in the macro `::core::ptr::addr_of_mut` which comes from the expansion of the derive macro `Archive` (in Nightly builds, run with -Z macro-backtrace for more info)

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:27 ~ ice_repro[7457]::_::{impl#0}::resolve), const_param_did: None }) (after phase change to runtime-optimized) at bb4[12]:
                                Field projection `_3.field[0]` specified type `rkyv::boxed::BoxResolver<()>`, but actual type is `<rkyv::with::With<rkyv::with::With<&[u8], rkyv::with::RefAsBox>, rkyv::with::CopyOptimize> as rkyv::Archive>::Resolver`
 --> src/lib.rs:6:10
  |
6 | #[derive(Archive, Serialize, Debug)]
  |          ^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:233:30
  = note: this error: internal compiler error originates in the derive macro `Archive` (in Nightly builds, run with -Z macro-backtrace for more info)

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:36 ~ ice_repro[7457]::_#1::{impl#0}::serialize), const_param_did: None }) (after phase change to runtime-optimized) at bb3[5]:
                                Field projection `_3.field[0]` specified type `rkyv::boxed::BoxResolver<()>`, but actual type is `<rkyv::with::With<rkyv::with::With<&[u8], rkyv::with::RefAsBox>, rkyv::with::CopyOptimize> as rkyv::Archive>::Resolver`
 --> src/lib.rs:6:19
  |
6 | #[derive(Archive, Serialize, Debug)]
  |                   ^^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:233:30
  = note: this error: internal compiler error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1610:13
stack backtrace:
   0:        0x10533716c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5bd648d504842b6c
   1:        0x1053b3348 - core::fmt::write::h8a30860ecea56bd6
   2:        0x10535b880 - std::io::Write::write_fmt::h274353ec696abd45
   3:        0x105336f7c - std::sys_common::backtrace::print::hae9327e0193c2484
   4:        0x10532c234 - std::panicking::default_hook::{{closure}}::h6c2d4b88437caf03
   5:        0x10532bfcc - std::panicking::default_hook::heb240acabf7815b4
   6:        0x1093db804 - rustc_driver[b35e9b6b737ab360]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x10532c884 - std::panicking::rust_panic_with_hook::hfdebfa07438c439a
   8:        0x10b30ed38 - std[d9acd6070f73bcf6]::panicking::begin_panic::<rustc_errors[491d78d41d29fe12]::ExplicitBug>::{closure#0}
   9:        0x10b30cbb4 - std[d9acd6070f73bcf6]::sys_common::backtrace::__rust_end_short_backtrace::<std[d9acd6070f73bcf6]::panicking::begin_panic<rustc_errors[491d78d41d29fe12]::ExplicitBug>::{closure#0}, !>
  10:        0x10b6a3180 - std[d9acd6070f73bcf6]::panicking::begin_panic::<rustc_errors[491d78d41d29fe12]::ExplicitBug>
  11:        0x10b2fdc4c - std[d9acd6070f73bcf6]::panic::panic_any::<rustc_errors[491d78d41d29fe12]::ExplicitBug>
  12:        0x10b305d3c - <rustc_errors[491d78d41d29fe12]::HandlerInner>::flush_delayed::<alloc[21e6e732353c4023]::vec::Vec<rustc_errors[491d78d41d29fe12]::diagnostic::Diagnostic>, &str>
  13:        0x10b3027bc - <rustc_errors[491d78d41d29fe12]::HandlerInner as core[ba9993f3380e93da]::ops::drop::Drop>::drop
  14:        0x1093ebd84 - core[ba9993f3380e93da]::ptr::drop_in_place::<rustc_session[30467953c583cb0d]::parse::ParseSess>
  15:        0x1093ed1fc - core[ba9993f3380e93da]::ptr::drop_in_place::<rustc_session[30467953c583cb0d]::session::Session>
  16:        0x1093c19f4 - core[ba9993f3380e93da]::ptr::drop_in_place::<rustc_interface[ebcbd89a6b84ecc5]::interface::Compiler>
  17:        0x1093ad1ac - rustc_span[80f08c829b755ffc]::with_source_map::<core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>, rustc_interface[ebcbd89a6b84ecc5]::interface::run_compiler<core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>, rustc_driver[b35e9b6b737ab360]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  18:        0x1093a6968 - <scoped_tls[8ddbc68b9cbb90b1]::ScopedKey<rustc_span[80f08c829b755ffc]::SessionGlobals>>::set::<rustc_interface[ebcbd89a6b84ecc5]::interface::run_compiler<core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>, rustc_driver[b35e9b6b737ab360]::run_compiler::{closure#1}>::{closure#0}, core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>>
  19:        0x1093f184c - std[d9acd6070f73bcf6]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ebcbd89a6b84ecc5]::util::run_in_thread_pool_with_globals<rustc_interface[ebcbd89a6b84ecc5]::interface::run_compiler<core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>, rustc_driver[b35e9b6b737ab360]::run_compiler::{closure#1}>::{closure#0}, core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>>
  20:        0x1093e0600 - <<std[d9acd6070f73bcf6]::thread::Builder>::spawn_unchecked_<rustc_interface[ebcbd89a6b84ecc5]::util::run_in_thread_pool_with_globals<rustc_interface[ebcbd89a6b84ecc5]::interface::run_compiler<core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>, rustc_driver[b35e9b6b737ab360]::run_compiler::{closure#1}>::{closure#0}, core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>>::{closure#1} as core[ba9993f3380e93da]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  21:        0x105355f94 - std::sys::unix::thread::Thread::new::thread_start::hcc1c30cde6d430b4
  22:        0x182c8206c - __pthread_deallocate

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.0 (fc594f156 2023-01-24) (built from a source tarball) running on aarch64-apple-darwin

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 `ice-repro`
Backtrace

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:27 ~ ice_repro[7457]::_::{impl#0}::resolve), const_param_did: None }) (after phase change to runtime-optimized) at bb0[2]:
                                Field projection `(*_4).field[0]` specified type `rkyv::boxed::ArchivedBox<[u8]>`, but actual type is `<rkyv::with::With<rkyv::with::With<&[u8], rkyv::with::RefAsBox>, rkyv::with::CopyOptimize> as rkyv::Archive>::Archived`
 --> src/lib.rs:6:10
  |
6 | #[derive(Archive, Serialize, Debug)]
  |          ^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:233:30
  = note: this error: internal compiler error originates in the macro `::core::ptr::addr_of_mut` which comes from the expansion of the derive macro `Archive` (in Nightly builds, run with -Z macro-backtrace for more info)

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:27 ~ ice_repro[7457]::_::{impl#0}::resolve), const_param_did: None }) (after phase change to runtime-optimized) at bb4[12]:
                                Field projection `_3.field[0]` specified type `rkyv::boxed::BoxResolver<()>`, but actual type is `<rkyv::with::With<rkyv::with::With<&[u8], rkyv::with::RefAsBox>, rkyv::with::CopyOptimize> as rkyv::Archive>::Resolver`
 --> src/lib.rs:6:10
  |
6 | #[derive(Archive, Serialize, Debug)]
  |          ^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:233:30
  = note: this error: internal compiler error originates in the derive macro `Archive` (in Nightly builds, run with -Z macro-backtrace for more info)

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:36 ~ ice_repro[7457]::_#1::{impl#0}::serialize), const_param_did: None }) (after phase change to runtime-optimized) at bb3[5]:
                                Field projection `_3.field[0]` specified type `rkyv::boxed::BoxResolver<()>`, but actual type is `<rkyv::with::With<rkyv::with::With<&[u8], rkyv::with::RefAsBox>, rkyv::with::CopyOptimize> as rkyv::Archive>::Resolver`
 --> src/lib.rs:6:19
  |
6 | #[derive(Archive, Serialize, Debug)]
  |                   ^^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:233:30
  = note: this error: internal compiler error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1610:13
stack backtrace:
   0:        0x10533716c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5bd648d504842b6c
   1:        0x1053b3348 - core::fmt::write::h8a30860ecea56bd6
   2:        0x10535b880 - std::io::Write::write_fmt::h274353ec696abd45
   3:        0x105336f7c - std::sys_common::backtrace::print::hae9327e0193c2484
   4:        0x10532c234 - std::panicking::default_hook::{{closure}}::h6c2d4b88437caf03
   5:        0x10532bfcc - std::panicking::default_hook::heb240acabf7815b4
   6:        0x1093db804 - rustc_driver[b35e9b6b737ab360]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x10532c884 - std::panicking::rust_panic_with_hook::hfdebfa07438c439a
   8:        0x10b30ed38 - std[d9acd6070f73bcf6]::panicking::begin_panic::<rustc_errors[491d78d41d29fe12]::ExplicitBug>::{closure#0}
   9:        0x10b30cbb4 - std[d9acd6070f73bcf6]::sys_common::backtrace::__rust_end_short_backtrace::<std[d9acd6070f73bcf6]::panicking::begin_panic<rustc_errors[491d78d41d29fe12]::ExplicitBug>::{closure#0}, !>
  10:        0x10b6a3180 - std[d9acd6070f73bcf6]::panicking::begin_panic::<rustc_errors[491d78d41d29fe12]::ExplicitBug>
  11:        0x10b2fdc4c - std[d9acd6070f73bcf6]::panic::panic_any::<rustc_errors[491d78d41d29fe12]::ExplicitBug>
  12:        0x10b305d3c - <rustc_errors[491d78d41d29fe12]::HandlerInner>::flush_delayed::<alloc[21e6e732353c4023]::vec::Vec<rustc_errors[491d78d41d29fe12]::diagnostic::Diagnostic>, &str>
  13:        0x10b3027bc - <rustc_errors[491d78d41d29fe12]::HandlerInner as core[ba9993f3380e93da]::ops::drop::Drop>::drop
  14:        0x1093ebd84 - core[ba9993f3380e93da]::ptr::drop_in_place::<rustc_session[30467953c583cb0d]::parse::ParseSess>
  15:        0x1093ed1fc - core[ba9993f3380e93da]::ptr::drop_in_place::<rustc_session[30467953c583cb0d]::session::Session>
  16:        0x1093c19f4 - core[ba9993f3380e93da]::ptr::drop_in_place::<rustc_interface[ebcbd89a6b84ecc5]::interface::Compiler>
  17:        0x1093ad1ac - rustc_span[80f08c829b755ffc]::with_source_map::<core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>, rustc_interface[ebcbd89a6b84ecc5]::interface::run_compiler<core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>, rustc_driver[b35e9b6b737ab360]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  18:        0x1093a6968 - <scoped_tls[8ddbc68b9cbb90b1]::ScopedKey<rustc_span[80f08c829b755ffc]::SessionGlobals>>::set::<rustc_interface[ebcbd89a6b84ecc5]::interface::run_compiler<core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>, rustc_driver[b35e9b6b737ab360]::run_compiler::{closure#1}>::{closure#0}, core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>>
  19:        0x1093f184c - std[d9acd6070f73bcf6]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ebcbd89a6b84ecc5]::util::run_in_thread_pool_with_globals<rustc_interface[ebcbd89a6b84ecc5]::interface::run_compiler<core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>, rustc_driver[b35e9b6b737ab360]::run_compiler::{closure#1}>::{closure#0}, core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>>
  20:        0x1093e0600 - <<std[d9acd6070f73bcf6]::thread::Builder>::spawn_unchecked_<rustc_interface[ebcbd89a6b84ecc5]::util::run_in_thread_pool_with_globals<rustc_interface[ebcbd89a6b84ecc5]::interface::run_compiler<core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>, rustc_driver[b35e9b6b737ab360]::run_compiler::{closure#1}>::{closure#0}, core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ba9993f3380e93da]::result::Result<(), rustc_errors[491d78d41d29fe12]::ErrorGuaranteed>>::{closure#1} as core[ba9993f3380e93da]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  21:        0x105355f94 - std::sys::unix::thread::Thread::new::thread_start::hcc1c30cde6d430b4
  22:        0x182c8206c - __pthread_deallocate

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.0 (fc594f156 2023-01-24) (built from a source tarball) running on aarch64-apple-darwin

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 `ice-repro`

[nix-shell:~/rust/ice-repro]$ RUST_BACKTRACE=1 ~/src/nixpkgs/result/bin/cargo b --release
   Compiling ice-repro v0.1.0 (/Users/winter/rust/ice-repro)
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:27 ~ ice_repro[7457]::_::{impl#0}::resolve), const_param_did: None }) (after phase change to runtime-optimized) at bb0[2]:
                                Field projection `(*_4).field[0]` specified type `rkyv::boxed::ArchivedBox<[u8]>`, but actual type is `<rkyv::with::With<rkyv::with::With<&[u8], rkyv::with::RefAsBox>, rkyv::with::CopyOptimize> as rkyv::Archive>::Archived`
 --> src/lib.rs:6:10
  |
6 | #[derive(Archive, Serialize, Debug)]
  |          ^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:233:30
  = note: this error: internal compiler error originates in the macro `::core::ptr::addr_of_mut` which comes from the expansion of the derive macro `Archive` (in Nightly builds, run with -Z macro-backtrace for more info)

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:27 ~ ice_repro[7457]::_::{impl#0}::resolve), const_param_did: None }) (after phase change to runtime-optimized) at bb4[12]:
                                Field projection `_3.field[0]` specified type `rkyv::boxed::BoxResolver<()>`, but actual type is `<rkyv::with::With<rkyv::with::With<&[u8], rkyv::with::RefAsBox>, rkyv::with::CopyOptimize> as rkyv::Archive>::Resolver`
 --> src/lib.rs:6:10
  |
6 | #[derive(Archive, Serialize, Debug)]
  |          ^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:233:30
  = note: this error: internal compiler error originates in the derive macro `Archive` (in Nightly builds, run with -Z macro-backtrace for more info)

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:36 ~ ice_repro[7457]::_#1::{impl#0}::serialize), const_param_did: None }) (after phase change to runtime-optimized) at bb3[5]:
                                Field projection `_3.field[0]` specified type `rkyv::boxed::BoxResolver<()>`, but actual type is `<rkyv::with::With<rkyv::with::With<&[u8], rkyv::with::RefAsBox>, rkyv::with::CopyOptimize> as rkyv::Archive>::Resolver`
 --> src/lib.rs:6:19
  |
6 | #[derive(Archive, Serialize, Debug)]
  |                   ^^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:233:30
  = note: this error: internal compiler error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1610:13
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: std::panic::panic_any::<rustc_errors::ExplicitBug>
   2: <rustc_errors::HandlerInner>::flush_delayed::<alloc::vec::Vec<rustc_errors::diagnostic::Diagnostic>, &str>
   3: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
   4: core::ptr::drop_in_place::<rustc_session::parse::ParseSess>
   5: core::ptr::drop_in_place::<rustc_session::session::Session>
   6: core::ptr::drop_in_place::<rustc_interface::interface::Compiler>
   7: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
   8: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.0 (fc594f156 2023-01-24) (built from a source tarball) running on aarch64-apple-darwin

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 `ice-repro`

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions