Skip to content

ICE building chrono #1464

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

Closed
sanxiyn opened this issue Mar 16, 2024 · 6 comments
Closed

ICE building chrono #1464

sanxiyn opened this issue Mar 16, 2024 · 6 comments
Labels
C-bug Category: This is a bug.

Comments

@sanxiyn
Copy link
Member

sanxiyn commented Mar 16, 2024

rustc 1.78.0-nightly (c67326b06 2024-03-15)

To reproduce:

git clone https://github.com/chronotope/chrono.git
cd chrono
git checkout 7afc6a2600fea734d134cb595c7249320a5c8695
RUSTFLAGS='-Z codegen-backend=cranelift' cargo +nightly build

The previous commit builds okay.

@bjorn3
Copy link
Member

bjorn3 commented Mar 16, 2024

thread 'rustc' panicked at /rustc/c67326b063bd27ed04f306ba2e372cd92e0a8751/compiler/rustc_middle/src/hir/mod.rs:157:84:
index out of bounds: the len is 4005 but the index is 4005
stack backtrace:
[...]
  18:     0x7f72807da3f2 - core::panicking::panic_bounds_check::hd46065b77a69d545
                               at /rustc/c67326b063bd27ed04f306ba2e372cd92e0a8751/library/core/src/panicking.rs:209:5
  19:     0x7f7284be2d6a - rustc_query_impl[5168e86bec57291]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5168e86bec57291]::query_impl::local_def_id_to_hir_id::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d475a138f66122e0]::query::erase::Erased<[u8; 8usize]>>
  20:     0x7f7284ed4ea2 - rustc_query_system[c2679a9664214c38]::query::plumbing::try_execute_query::<rustc_query_impl[5168e86bec57291]::DynamicConfig<rustc_query_system[c2679a9664214c38]::query::caches::VecCache<rustc_span[1de926e68631d1ca]::def_id::LocalDefId, rustc_middle[d475a138f66122e0]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5168e86bec57291]::plumbing::QueryCtxt, true>
  21:     0x7f7284ed3a59 - rustc_query_impl[5168e86bec57291]::query_impl::local_def_id_to_hir_id::get_query_incr::__rust_end_short_backtrace
  22:     0x7f7282856205 - rustc_hir_analysis[b0510b7757423d5d]::collect::type_of::type_of
  23:     0x7f7284ab2062 - rustc_query_impl[5168e86bec57291]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5168e86bec57291]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d475a138f66122e0]::query::erase::Erased<[u8; 8usize]>>
  24:     0x7f7284db2df6 - rustc_query_system[c2679a9664214c38]::query::plumbing::try_execute_query::<rustc_query_impl[5168e86bec57291]::DynamicConfig<rustc_query_system[c2679a9664214c38]::query::caches::DefIdCache<rustc_middle[d475a138f66122e0]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5168e86bec57291]::plumbing::QueryCtxt, true>
  25:     0x7f7284c58bd9 - rustc_query_impl[5168e86bec57291]::query_impl::type_of::get_query_incr::__rust_end_short_backtrace
  26:     0x7f728555665a - <rustc_middle[d475a138f66122e0]::ty::instance::Instance>::ty
  27:     0x7f7276e1a88c - rustc_codegen_cranelift[e5e665717e25ea82]::constant::data_id_for_static
  28:     0x7f7276e188b2 - <rustc_codegen_cranelift[e5e665717e25ea82]::constant::ConstantCx>::finalize
  29:     0x7f7276e21b23 - rustc_codegen_cranelift[e5e665717e25ea82]::driver::aot::module_codegen::{closure#0}
  30:     0x7f7276e20207 - rustc_codegen_cranelift[e5e665717e25ea82]::driver::aot::module_codegen
[...]
query stack during panic:
#0 [local_def_id_to_hir_id] getting HIR ID of `format::strftime::<impl at src/format/strftime.rs:252:1: 252:27>::parse_next_item::D_FMT::{constant#0}`
#1 [type_of] computing type of `format::strftime::<impl at src/format/strftime.rs:252:1: 252:27>::parse_next_item::D_FMT::{constant#0}`
end of query stack

@bjorn3 bjorn3 added the C-bug Category: This is a bug. label Mar 16, 2024
@bjorn3
Copy link
Member

bjorn3 commented Mar 16, 2024

Codegening the static in the following is enough to cause this ICE:

const fn no_str() -> Option<Box<str>> {
    None
}

static STATIC_WITH_MAYBE_NESTED_BOX: &Option<Box<str>> = &no_str();

@bjorn3 bjorn3 closed this as completed in e775fdc Mar 16, 2024
@bjorn3
Copy link
Member

bjorn3 commented Mar 16, 2024

Should be fixed in the latest version of cg_clif in this repo. Will open a PR to sync it to the rust repo to get the rustup distributed version fixed later today. In the mean time you can download a prebuilt version from https://github.com/rust-lang/rustc_codegen_cranelift/releases/tag/dev

@bjorn3
Copy link
Member

bjorn3 commented Mar 16, 2024

The first nightly after rust-lang/rust#122599 merges will have this fix.

@bjorn3
Copy link
Member

bjorn3 commented Mar 17, 2024

Should be fixed with the latest nightly.

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.
Projects
None yet
Development

No branches or pull requests

2 participants