rust-lang / rust-lang/rust

ICE while compiling diesel

Open
#149,309 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hello everyone, I got this ICE today, but unfortunately I cannot reproduce the error. It just worked on the second try.

rustc --version --verbose:

rustc 1.91.0 (f8297e351 2025-10-28)
binary: rustc
commit-hash: f8297e351a40c1439a467bbbb6879088047f50b3
commit-date: 2025-10-28
host: x86_64-unknown-linux-gnu
release: 1.91.0
LLVM version: 21.1.2
Error output
thread 'rustc' (104872) panicked at compiler/rustc_metadata/src/creader.rs:242:31:
index out of bounds: the len is 29 but the index is 3233284272
stack backtrace:
   0:     0x7f8c76650a23 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h4e0a3aeea0f9c085
   1:     0x7f8c76e01bd8 - core::fmt::write::hecf68a131630c74d
   2:     0x7f8c784b57af - std::io::Write::write_fmt::h93c9a261259c931a
   3:     0x7f8c76615ee2 - std::sys::backtrace::BacktraceLock::print::h75160192768e5621
   4:     0x7f8c7661be39 - std::panicking::default_hook::{{closure}}::h14d82797cfb1ddcb
   5:     0x7f8c7661b963 - std::panicking::default_hook::h63f9bf8161c5d325
   6:     0x7f8c756024e7 - std[752e03a6421f8218]::panicking::update_hook::<alloc[cb649fc9a76fa509]::boxed::Box<rustc_driver_impl[7060c14ee153e4be]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7f8c7661c25f - std::panicking::panic_with_hook::h3173740e06bd0752
   8:     0x7f8c7661c01a - std::panicking::panic_handler::{{closure}}::hbac492c61eb56a87
   9:     0x7f8c76616029 - std::sys::backtrace::__rust_end_short_backtrace::haa3eac3df9535320
  10:     0x7f8c765f698d - __rustc[de0091b922c53d7e]::rust_begin_unwind
  11:     0x7f8c72ce7940 - core::panicking::panic_fmt::h5138da2ef87be35b
  12:     0x7f8c74cdbab3 - core::panicking::panic_bounds_check::h9bbcb0758914da05
  13:     0x7f8c77a85925 - rustc_metadata[49038a60e10b3943]::rmeta::decoder::cstore_impl::provide_extern::const_conditions
  14:     0x7f8c77a85357 - rustc_query_impl[105cc161e39911be]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[105cc161e39911be]::query_impl::const_conditions::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d4b0c03c541beb2b]::query::erase::Erased<[u8; 24usize]>>
  15:     0x7f8c77a85321 - <rustc_query_impl[105cc161e39911be]::query_impl::const_conditions::dynamic_query::{closure#2} as core[23fa5c620bd8b707]::ops::function::FnOnce<(rustc_middle[d4b0c03c541beb2b]::ty::context::TyCtxt, rustc_span[56f068732132fb52]::def_id::DefId)>>::call_once
  16:     0x7f8c76fafa78 - rustc_query_system[eecf37c567c7c9f0]::query::plumbing::try_execute_query::<rustc_query_impl[105cc161e39911be]::DynamicConfig<rustc_query_system[eecf37c567c7c9f0]::query::caches::DefIdCache<rustc_middle[d4b0c03c541beb2b]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[105cc161e39911be]::plumbing::QueryCtxt, false>
  17:     0x7f8c77640970 - rustc_query_impl[105cc161e39911be]::query_impl::const_conditions::get_query_non_incr::__rust_end_short_backtrace
  18:     0x7f8c77640baf - <rustc_middle[d4b0c03c541beb2b]::ty::generics::ConstConditions>::instantiate_identity_into
  19:     0x7f8c776400fa - rustc_ty_utils[1ab6fa071a2a29fa]::ty::param_env
  20:     0x7f8c7763ec3d - rustc_query_impl[105cc161e39911be]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[105cc161e39911be]::query_impl::param_env::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d4b0c03c541beb2b]::query::erase::Erased<[u8; 8usize]>>
  21:     0x7f8c76e1abb9 - rustc_query_system[eecf37c567c7c9f0]::query::plumbing::try_execute_query::<rustc_query_impl[105cc161e39911be]::DynamicConfig<rustc_query_system[eecf37c567c7c9f0]::query::caches::DefIdCache<rustc_middle[d4b0c03c541beb2b]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[105cc161e39911be]::plumbing::QueryCtxt, false>
  22:     0x7f8c76e1a69d - rustc_query_impl[105cc161e39911be]::query_impl::param_env::get_query_non_incr::__rust_end_short_backtrace
  23:     0x7f8c76fad8b6 - rustc_query_impl[105cc161e39911be]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[105cc161e39911be]::query_impl::typing_env_normalized_for_post_analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d4b0c03c541beb2b]::query::erase::Erased<[u8; 24usize]>>
  24:     0x7f8c76fad5a9 - <rustc_query_impl[105cc161e39911be]::query_impl::typing_env_normalized_for_post_analysis::dynamic_query::{closure#2} as core[23fa5c620bd8b707]::ops::function::FnOnce<(rustc_middle[d4b0c03c541beb2b]::ty::context::TyCtxt, rustc_span[56f068732132fb52]::def_id::DefId)>>::call_once
  25:     0x7f8c76fafa78 - rustc_query_system[eecf37c567c7c9f0]::query::plumbing::try_execute_query::<rustc_query_impl[105cc161e39911be]::DynamicConfig<rustc_query_system[eecf37c567c7c9f0]::query::caches::DefIdCache<rustc_middle[d4b0c03c541beb2b]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[105cc161e39911be]::plumbing::QueryCtxt, false>
  26:     0x7f8c76faf1a2 - rustc_query_impl[105cc161e39911be]::query_impl::typing_env_normalized_for_post_analysis::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7f8c77c0442b - <rustc_middle[d4b0c03c541beb2b]::ty::TypingEnv>::post_analysis::<rustc_span[56f068732132fb52]::def_id::DefId>
  28:     0x7f8c77c02e00 - rustc_mir_transform[66c6cad113eb7cce]::shim::build_adt_ctor
  29:     0x7f8c77a66196 - rustc_mir_transform[66c6cad113eb7cce]::optimized_mir
  30:     0x7f8c77a65d5d - rustc_query_impl[105cc161e39911be]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[105cc161e39911be]::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d4b0c03c541beb2b]::query::erase::Erased<[u8; 8usize]>>
  31:     0x7f8c76e1abb9 - rustc_query_system[eecf37c567c7c9f0]::query::plumbing::try_execute_query::<rustc_query_impl[105cc161e39911be]::DynamicConfig<rustc_query_system[eecf37c567c7c9f0]::query::caches::DefIdCache<rustc_middle[d4b0c03c541beb2b]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[105cc161e39911be]::plumbing::QueryCtxt, false>
  32:     0x7f8c76e1a05b - rustc_query_impl[105cc161e39911be]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7f8c7777bee0 - <rustc_metadata[49038a60e10b3943]::rmeta::encoder::EncodeContext>::encode_crate_root
  34:     0x7f8c783af494 - <rustc_metadata[49038a60e10b3943]::rmeta::encoder::encode_metadata::{closure#3} as core[23fa5c620bd8b707]::ops::function::FnOnce<(rustc_middle[d4b0c03c541beb2b]::ty::context::TyCtxt, &std[752e03a6421f8218]::path::Path)>>::call_once
  35:     0x7f8c783ac250 - rustc_metadata[49038a60e10b3943]::rmeta::encoder::encode_metadata
  36:     0x7f8c77d0f223 - rustc_metadata[49038a60e10b3943]::fs::encode_and_write_metadata
  37:     0x7f8c780c0f69 - <rustc_interface[356b87dbb86a0c69]::queries::Linker>::codegen_and_build_linker
  38:     0x7f8c780bead5 - rustc_interface[356b87dbb86a0c69]::passes::create_and_enter_global_ctxt::<core[23fa5c620bd8b707]::option::Option<rustc_interface[356b87dbb86a0c69]::queries::Linker>, rustc_driver_impl[7060c14ee153e4be]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  39:     0x7f8c780ae6be - rustc_interface[356b87dbb86a0c69]::interface::run_compiler::<(), rustc_driver_impl[7060c14ee153e4be]::run_compiler::{closure#0}>::{closure#1}
  40:     0x7f8c77fde7b8 - std[752e03a6421f8218]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[356b87dbb86a0c69]::util::run_in_thread_with_globals<rustc_interface[356b87dbb86a0c69]::util::run_in_thread_pool_with_globals<rustc_interface[356b87dbb86a0c69]::interface::run_compiler<(), rustc_driver_impl[7060c14ee153e4be]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  41:     0x7f8c77fde49c - <<std[752e03a6421f8218]::thread::Builder>::spawn_unchecked_<rustc_interface[356b87dbb86a0c69]::util::run_in_thread_with_globals<rustc_interface[356b87dbb86a0c69]::util::run_in_thread_pool_with_globals<rustc_interface[356b87dbb86a0c69]::interface::run_compiler<(), rustc_driver_impl[7060c14ee153e4be]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[23fa5c620bd8b707]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7f8c77fe4a6f - std::sys::thread::unix::Thread::new::thread_start::h38da0f633f090ce2
  43:     0x7f8c7169698b - <unknown>
  44:     0x7f8c7171a9cc - <unknown>
  45:                0x0 - <unknown>

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.91.0 (f8297e351 2025-10-28) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
panicked at compiler/rustc_metadata/src/creader.rs:242:31:

thread panicked while processing panic. aborting.
error: could not compile `diesel` (lib)

Caused by:
  process didn't exit successfully: `/home/.../.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name diesel --edition=2021 /home/.../.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-2.3.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=257 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="32-column-tables"' --cfg 'feature="chrono"' --cfg 'feature="default"' --cfg 'feature="returning_clauses_for_sqlite_3_35"' --cfg 'feature="sqlite"' --cfg 'feature="with-deprecated"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("128-column-tables", "32-column-tables", "64-column-tables", "__with_asan_tests", "chrono", "default", "extras", "huge-tables", "i-implement-a-third-party-backend-and-opt-into-breaking-changes", "ipnet-address", "large-tables", "mysql", "mysql_backend", "mysqlclient-src", "network-address", "numeric", "postgres", "postgres_backend", "pq-src", "quickcheck", "r2d2", "returning_clauses_for_sqlite_3_35", "serde_json", "sqlite", "time", "unstable", "uuid", "with-deprecated", "without-deprecated"))' -C metadata=e23e6c90b40f543c -C extra-filename=-963123a2833e7bf7 --out-dir /home/.../target/debug/deps -L dependency=/home/.../target/debug/deps --extern chrono=/home/.../target/debug/deps/libchrono-a49e19a7472d3b8e.rmeta --extern diesel_derives=/home/.../target/debug/deps/libdiesel_derives-8a36cd024897441e.so --extern downcast_rs=/home/.../target/debug/deps/libdowncast_rs-518f2c82c51df6e9.rmeta --extern libsqlite3_sys=/home/.../target/debug/deps/liblibsqlite3_sys-52b4e39350101cc8.rmeta --cap-lints allow -C target-cpu=native -L native=/home/.../target/debug/build/libsqlite3-sys-efaf715ab56af74b/out` (signal: 6, SIGABRT: process abort signal)

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 trying to reproduce the ICE while compiling Diesel 2.3.2 with rustc 1.91.0 on x86_64-unknown-linux-gnu and the reported flags. Inspect compiler/rustc_metadata/src/creader.rs:242:31 and the query stack around const_conditions; done means obtaining a minimal reproducible case and identifying a confirmed compiler fix or diagnostic path.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.