Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal compiler error: no errors encountered even though delay_span_bug issued #106650

Open
dignifiedquire opened this issue Jan 9, 2023 · 1 comment
Labels
C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dignifiedquire
Copy link

Ran into this while writing some code using rkyv. Below is the smallest version I could come up with

Code

use std::borrow::Cow;

use bytecheck::CheckBytes;
use rkyv::{with, AlignedVec, Archive, Deserialize, Infallible, Serialize};

#[derive(Archive, Deserialize, Serialize, Debug, PartialEq, Clone)]
#[archive_attr(derive(CheckBytes))]
struct Response<'a> {
    id: u64,
    data: Res<'a>,
}

#[derive(Archive, Deserialize, Serialize, Debug, PartialEq, Clone)]
#[archive_attr(derive(CheckBytes))]
enum Res<'a> {
    NotFound,
    Found {
        #[with(with::AsOwned)]
        data: Cow<'a, [u8]>,
    },
}

fn main() {
    use rkyv::ser::{serializers::AllocSerializer, Serializer};

    let data = vec![0u8; 10];
    let value = Response {
        id: 1,
        data: Res::Found {
            data: Cow::Borrowed(&data[..]),
        },
    };

    let mut serializer = AllocSerializer::<0>::default();
    serializer.serialize_value(&value).unwrap();
    let bytes = serializer.into_serializer().into_inner();
    let archived = rkyv::check_archived_root::<Response>(&bytes[..]).unwrap();
}

Meta

rustc --version --verbose:

rustc --version --verbose
rustc 1.68.0-nightly (cc47b0699 2023-01-08)
binary: rustc
commit-hash: cc47b069983292e4ee8982d5dabe6301452c5f25
commit-date: 2023-01-08
host: x86_64-unknown-linux-gnu
release: 1.68.0-nightly
LLVM version: 15.0.6

Error output

warning: Error finalizing incremental compilation session directory `/home/dig/opensource/sendme/target/debug/incremental/bug-33mav586xwwvk/s-gh4q7w4i
ib-6vgmy4-working`: No such file or directory (os error 2)

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

error: internal compiler error: failed to normalize <<With<Cow<'_, [u8]>, AsOwned> as Archive>::Archived as bytecheck::CheckBytes<__C>>::Error
  --> src/bug.rs:14:23
Backtrace

warning: unused imports: `AlignedVec`, `Infallible`
 --> src/bug.rs:4:12
  |
4 | use rkyv::{Infallible, AlignedVec, Deserialize, Archive, Serializ...
  |            ^^^^^^^^^^  ^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused variable: `archived`
  --> src/bug.rs:35:9
   |
35 |     let archived = rkyv::check_archived_root::<Response>(&bytes[...
   |         ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_archived`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: Error finalizing incremental compilation session directory `/home/dig/opensource/sendme/target/debug/incremental/bug-33mav586xwwvk/s-gh4q7w4i
ib-6vgmy4-working`: No such file or directory (os error 2)

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

error: internal compiler error: failed to normalize <<With<Cow<'_, [u8]>, AsOwned> as Archive>::Archived as bytecheck::CheckBytes<__C>>::Error
  --> src/bug.rs:14:23
   |
14 | #[archive_attr(derive(CheckBytes))]
   |                       ^^^^^^^^^^
   |
   = note: delayed at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/compiler/rustc_const_eval/src/interpret/eval_context.rs:510:31
   = note: this error: internal compiler error originates in the derive macro `CheckBytes` (in Nightly builds, run with -Z macro-backtrace for more in
fo)

error: internal compiler error: failed to normalize Box<<<With<Cow<'_, [u8]>, AsOwned> as Archive>::Archived as bytecheck::CheckBytes<__C>>::Error>
  --> src/bug.rs:14:23
   |
14 | #[archive_attr(derive(CheckBytes))]
   |                       ^^^^^^^^^^
   |
   = note: delayed at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/compiler/rustc_const_eval/src/interpret/eval_context.rs:510:31
   = note: this error: internal compiler error originates in the derive macro `CheckBytes` (in Nightly builds, run with -Z macro-backtrace for more in
fo)

error: internal compiler error: failed to normalize <<Res<'_> as Archive>::Archived as bytecheck::CheckBytes<__C>>::Error
 --> src/bug.rs:6:10
  |
6 | #[derive(Archive, Deserialize, Serialize, Debug, PartialEq, Clone)]
  |          ^^^^^^^
  |
  = note: delayed at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/compiler/rustc_const_eval/src/interpret/eval_context.rs:510:31
  = 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: failed to normalize Box<<<Res<'_> as Archive>::Archived as bytecheck::CheckBytes<__C>>::Error>
 --> src/bug.rs:6:10
  |
6 | #[derive(Archive, Deserialize, Serialize, Debug, PartialEq, Clone)]
  |          ^^^^^^^
  |
  |
  = note: delayed at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/compiler/rustc_const_eval/src/interpret/eval_context.rs:510:31
  = note: this error: internal compiler error originates in the derive macro `Archive` (in Nightly builds, run with -Z macro-backtrace for more info)

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1638:13
stack backtrace:
   0:     0x7f0acf7eb31a - std::backtrace_rs::backtrace::libunwind::trace::h226871b03ab0ff9d
                               at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f0acf7eb31a - std::backtrace_rs::backtrace::trace_unsynchronized::hfec460a379dfa930
                               at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f0acf7eb31a - std::sys_common::backtrace::_print_fmt::h47e3347a7a00a0b8
                               at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f0acf7eb31a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h29295205afe55042
                               at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f0acf84e55e - core::fmt::write::hff0191b598fb3b0b
                               at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/core/src/fmt/mod.rs:1208:17
   5:     0x7f0acf7db8f5 - std::io::Write::write_fmt::hbb504f8b613362a3
                               at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/std/src/io/mod.rs:1682:15
   6:     0x7f0acf7eb0e5 - std::sys_common::backtrace::_print::h4823cbf15bd070e6
                               at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f0acf7eb0e5 - std::sys_common::backtrace::print::hf66f5a9cb072cea8
                               at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f0acf7edeaf - std::panicking::default_hook::{{closure}}::h7bc0efdcc3bf56a7
                               at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/std/src/panicking.rs:267:22
   9:     0x7f0acf7edbeb - std::panicking::default_hook::h3f54f5b4fb31e406
                               at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/std/src/panicking.rs:286:9
  10:     0x7f0ad2b2a604 - <rustc_driver[18602304c3814321]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[86ba13369de38d4f]::ops::function::FnOnce<(&
core[86ba13369de38d4f]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f0acf7ee6ed - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h110d68855a8f4925
  12:     0x7f0acf7ee6ed - std::panicking::rust_panic_with_hook::haada24ea54b92d70                                                           [15/7527]
                               at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/std/src/panicking.rs:692:13                                   13:     0x7f0ad2b4abd1 - std[b80f5c9d0036a11a]::panicking::begin_panic::<rustc_errors[109729f310d9e279]::ExplicitBug>::{closure#0}                    14:     0x7f0ad2b48446 - std[b80f5c9d0036a11a]::sys_common::backtrace::__rust_end_short_backtrace::<std[b80f5c9d0036a11a]::panicking::begin_panic<ru
stc_errors[109729f310d9e279]::ExplicitBug>::{closure#0}, !>                                                                                             15:     0x7f0ad2b40c06 - std[b80f5c9d0036a11a]::panicking::begin_panic::<rustc_errors[109729f310d9e279]::ExplicitBug>                                 16:     0x7f0ad2b41e06 - std[b80f5c9d0036a11a]::panic::panic_any::<rustc_errors[109729f310d9e279]::ExplicitBug>                                       17:     0x7f0ad2068cc6 - <rustc_errors[109729f310d9e279]::HandlerInner>::flush_delayed::<alloc[593078ccfaa74f72]::vec::Vec<rustc_errors[109729f310d9e279]::diagnostic::Diagnostic>, &str, rustc_errors[109729f310d9e279]::ExplicitBug>
  18:     0x7f0ad2067fcb - <rustc_errors[109729f310d9e279]::HandlerInner as core[86ba13369de38d4f]::ops::drop::Drop>::drop                              19:     0x7f0ad1d5b31e - core[86ba13369de38d4f]::ptr::drop_in_place::<rustc_session[428dcc9dad4836a4]::parse::ParseSess>                              20:     0x7f0ad1d4a24f - core[86ba13369de38d4f]::ptr::drop_in_place::<rustc_session[428dcc9dad4836a4]::session::Session>                              21:     0x7f0ad1d49f80 - core[86ba13369de38d4f]::ptr::drop_in_place::<rustc_interface[50bdaa1023eb7121]::interface::Compiler>                         22:     0x7f0ad1d49051 - rustc_span[4276d354efecb51]::with_source_map::<core[86ba13369de38d4f]::result::Result<(), rustc_errors[109729f310d9e279]::E
rrorGuaranteed>, rustc_interface[50bdaa1023eb7121]::interface::run_compiler<core[86ba13369de38d4f]::result::Result<(), rustc_errors[109729f310d9e279]:
:ErrorGuaranteed>, rustc_driver[18602304c3814321]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  23:     0x7f0ad1d48965 - <scoped_tls[d847452d4e157dba]::ScopedKey<rustc_span[4276d354efecb51]::SessionGlobals>>::set::<rustc_interface[50bdaa1023eb7
121]::interface::run_compiler<core[86ba13369de38d4f]::result::Result<(), rustc_errors[109729f310d9e279]::ErrorGuaranteed>, rustc_driver[18602304c38143
21]::run_compiler::{closure#1}>::{closure#0}, core[86ba13369de38d4f]::result::Result<(), rustc_errors[109729f310d9e279]::ErrorGuaranteed>>
  24:     0x7f0ad1d47f52 - std[b80f5c9d0036a11a]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[50bdaa1023eb7121]::util::run_i
n_thread_pool_with_globals<rustc_interface[50bdaa1023eb7121]::interface::run_compiler<core[86ba13369de38d4f]::result::Result<(), rustc_errors[109729f3
10d9e279]::ErrorGuaranteed>, rustc_driver[18602304c3814321]::run_compiler::{closure#1}>::{closure#0}, core[86ba13369de38d4f]::result::Result<(), rustc
_errors[109729f310d9e279]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[86ba13369de38d4f]::result::Result<(), rustc_errors[109729f310d9e279]::Err
orGuaranteed>>
  25:     0x7f0ad23f09aa - <<std[b80f5c9d0036a11a]::thread::Builder>::spawn_unchecked_<rustc_interface[50bdaa1023eb7121]::util::run_in_thread_pool_wit
h_globals<rustc_interface[50bdaa1023eb7121]::interface::run_compiler<core[86ba13369de38d4f]::result::Result<(), rustc_errors[109729f310d9e279]::ErrorG
uaranteed>, rustc_driver[18602304c3814321]::run_compiler::{closure#1}>::{closure#0}, core[86ba13369de38d4f]::result::Result<(), rustc_errors[109729f31
0d9e279]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[86ba13369de38d4f]::result::Result<(), rustc_errors[109729f310d9e279]::ErrorGuaranteed>>::{
closure#1} as core[86ba13369de38d4f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  26:     0x7f0acf7f8b23 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h379e1b9bda46509f
                               at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/alloc/src/boxed.rs:1988:9
  27:     0x7f0acf7f8b23 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf86d10042d2e6078
                               at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/alloc/src/boxed.rs:1988:9
  28:     0x7f0acf7f8b23 - std::sys::unix::thread::Thread::new::thread_start::h3f27ea3a68953b7e
                               at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/std/src/sys/unix/thread.rs:108:17
  29:     0x7f0acf55a78d - <unknown>
  30:     0x7f0acf5db8e4 - clone
  31:                0x0 - <unknown>
  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.68.0-nightly (cc47b0699 2023-01-08) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
warning: `sendme` (bin "bug") generated 3 warnings (run `cargo fix --bin "bug"` to apply 2 suggestions)
error: could not compile `sendme`; 3 warnings emitted```

</p>
</details>

@dignifiedquire dignifiedquire added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 9, 2023
@compiler-errors
Copy link
Member

This is a duplicate of #94651 I think.

@JohnTitor JohnTitor added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants