rust-lang / rust-lang/rust

rustc build crash

Open
#140,508 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug E-needs-bisection E-needs-mcve I-ICE T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
git@github.com:JohanChane/clashtui.git
Meta

rustc --version --verbose:

# rustc --version --verbose
rustc 1.86.0 (05f9846f8 2025-03-31)
binary: rustc
commit-hash: 05f9846f893b09a1be1fc8560e33fc3c815cfecb
commit-date: 2025-03-31
host: x86_64-unknown-linux-musl
release: 1.86.0
LLVM version: 19.1.7
Error output
   Compiling synstructure v0.13.1
   Compiling serde_derive v1.0.197
   Compiling zerovec-derive v0.10.3
   Compiling displaydoc v0.2.5
   Compiling zerofrom-derive v0.1.5
   Compiling yoke-derive v0.7.5
   Compiling writeable v0.5.5

thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/decoder.rs:1032:66:
index out of bounds: the len is 1 but the index is 2
stack backtrace:
   0: rust_begin_unwind
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:695:5
   1: core::panicking::panic_fmt
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/panicking.rs:75:14
   2: core::panicking::panic_bounds_check
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/panicking.rs:273:5
   3: <rustc_metadata::rmeta::decoder::DecodeContext as rustc_span::SpanDecoder>::decode_crate_num
   4: <rustc_metadata::rmeta::decoder::DecodeContext as rustc_span::SpanDecoder>::decode_expn_id
   5: <rustc_span::hygiene::ExpnData as rustc_serialize::serialize::Decodable<rustc_metadata::rmeta::decoder::DecodeContext>>::decode
   6: <rustc_metadata::rmeta::decoder::DecodeContext as rustc_span::SpanDecoder>::decode_expn_id
   7: <rustc_metadata::rmeta::decoder::DecodeContext as rustc_span::SpanDecoder>::decode_syntax_context
   8: <rustc_span::SpanData as rustc_serialize::serialize::Decodable<rustc_metadata::rmeta::decoder::DecodeContext>>::decode
   9: <rustc_metadata::rmeta::decoder::DecodeContext as rustc_span::SpanDecoder>::decode_span
  10: <rustc_ast::ast::MetaItemLit as rustc_serialize::serialize::Decodable<rustc_metadata::rmeta::decoder::DecodeContext>>::decode
  11: <rustc_hir::hir::Attribute as rustc_serialize::serialize::Decodable<rustc_metadata::rmeta::decoder::DecodeContext>>::decode
  12: <smallvec::SmallVec<[rustc_hir::hir::Attribute; 8]> as core::iter::traits::collect::Extend<rustc_hir::hir::Attribute>>::extend::<rustc_metadata::rmeta::decoder::DecodeIterator<rustc_hir::hir::Attribute>>
  13: rustc_metadata::rmeta::decoder::cstore_impl::provide_extern::attrs_for_def
      [... omitted 2 frames ...]
  14: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 16]>>>
  15: <rustc_const_eval::check_consts::check::Checker as rustc_middle::mir::visit::Visitor>::visit_terminator
  16: <rustc_const_eval::check_consts::check::Checker>::check_body
  17: rustc_mir_transform::mir_const_qualif
      [... omitted 2 frames ...]
  18: rustc_mir_transform::mir_promoted
      [... omitted 2 frames ...]
  19: rustc_borrowck::mir_borrowck
      [... omitted 2 frames ...]
  20: rustc_middle::query::plumbing::query_get_at::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>>
  21: rustc_mir_transform::mir_drops_elaborated_and_const_checked
      [... omitted 2 frames ...]
  22: rustc_middle::query::plumbing::query_get_at::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>>
  23: rustc_mir_transform::mir_for_ctfe
      [... omitted 2 frames ...]
  24: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 8]>>>
  25: <rustc_const_eval::interpret::eval_context::InterpCx<rustc_const_eval::const_eval::machine::CompileTimeMachine>>::load_mir
  26: rustc_const_eval::const_eval::eval_queries::eval_to_allocation_raw_provider
      [... omitted 2 frames ...]
  27: rustc_const_eval::const_eval::eval_queries::eval_to_const_value_raw_provider
      [... omitted 2 frames ...]
  28: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_hir_analysis::check_crate::{closure#2}>::{closure#0}
  29: rustc_hir_analysis::check_crate
  30: rustc_interface::passes::analysis
      [... omitted 2 frames ...]
  31: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
  32: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}>
  33: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  34: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
  35: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>
  36: rustc_span::create_session_globals_then::<(), rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: 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.86.0 (05f9846f8 2025-03-31) running on x86_64-unknown-linux-musl

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2

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

query stack during panic:
#0 [attrs_for_def] collecting attributes of `core::num::<impl u32>::ilog10`
#1 [mir_const_qualif] const checking `impls::<impl at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/writeable-0.5.5/src/impls.rs:10:9: 10:38>::write_to::MAX_LEN`
#2 [mir_promoted] promoting constants in MIR for `impls::<impl at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/writeable-0.5.5/src/impls.rs:10:9: 10:38>::write_to::MAX_LEN`
#3 [mir_borrowck] borrow-checking `impls::<impl at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/writeable-0.5.5/src/impls.rs:10:9: 10:38>::write_to::MAX_LEN`
#4 [mir_drops_elaborated_and_const_checked] elaborating drops for `impls::<impl at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/writeable-0.5.5/src/impls.rs:10:9: 10:38>::write_to::MAX_LEN`
#5 [mir_for_ctfe] caching mir of `impls::<impl at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/writeable-0.5.5/src/impls.rs:10:9: 10:38>::write_to::MAX_LEN` for CTFE  |  = note: this failure-note originates in the macro `impl_write_num` (in Nightly builds, run with -Z macro-backtrace for more info)

#6 [eval_to_allocation_raw] const-evaluating + checking `impls::<impl at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/writeable-0.5.5/src/impls.rs:10:9: 10:38>::write_to::MAX_LEN`
#7 [eval_to_const_value_raw] simplifying constant for the type system `impls::<impl at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/writeable-0.5.5/src/impls.rs:10:9: 10:38>::write_to::MAX_LEN`
#8 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `writeable` (lib)

Caused by:
  process didn't exit successfully: `/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/bin/rustc --crate-name writeable --edition=2021 /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/writeable-0.5.5/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("bench", "either"))' -C metadata=19b3ed98f11d9422 -C extra-filename=-1d25687a78a655bf --out-dir /etc/qdoor/clashtui/clashtui/target/debug/deps -L dependency=/etc/qdoor/clashtui/clashtui/target/debug/deps --cap-lints allow` (exit status: 101)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by cloning git@github.com:JohanChane/clashtui.git and reproducing the crash with rustc 1.86.0 on x86_64-unknown-linux-musl. Read compiler/rustc_metadata/src/rmeta/decoder.rs around the reported bounds failure and the writeable-0.5.5 impls.rs location; done means identifying the cause and preventing the compiler panic while preserving the reported compilation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.