[ICE]: MacOS 26.2 nightly const generics (generic_const_exprs) backtrace from V0SymbolMangler.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
So in my crate: https://github.com/rcarson3/HelixSnail , I was recently trying to update my crate to the latest version of rust nightly as it was about 7 months since I had last tried to see how the nightly aspect of const generics had improved. I found that currently I'm hitting an ICE in some of my tests. See the below for the actual test hitting the ICE. I wasn't able to necessarily to figure out the minimization aspect to create a smaller example. However, I did find that the error first started to appear within rustc version: 1.93.0-nightly (6647be936 2025-11-09) platform: aarch64-apple-darwin. Earlier versions compiled and ran just fine.
Code
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
extern crate env_logger;
extern crate helix_snail;
extern crate num_traits as libnum;
use helix_snail::nonlinear_solver::*;
use libnum::{Float, NumAssignOps, NumOps, One, Zero};
use log::{info, error};
// This doesn't need to be a global value.
// I just had it for testing purposes.
// A value less than or equal to 0 does not log anything
// Any value greater than 0 will cause logs to be produced
const LOGGING_LEVEL: i32 = 1;
struct Broyden<F>
where
F: helix_snail::FloatType,
{
lambda: F,
pub logging_level: i32,
}
impl<F> NonlinearSystemSize for Broyden<F>
where
F: helix_snail::FloatType,
{
const NDIM: usize = 8;
}
impl<F> NonlinearNDProblem<F> for Broyden<F>
where
F: helix_snail::FloatType,
[(); Self::NDIM]:
{
fn compute_resid_jacobian(
&mut self,
x: &[F],
fcn_eval: &mut [F],
opt_jacobian: Option<&mut [F]>,
) -> bool {
assert!(fcn_eval.len() >= Self::NDIM);
assert!(x.len() >= Self::NDIM);
let two: F = F::from(2.0).unwrap();
let three: F = F::from(3.0).unwrap();
let four: F = F::from(4.0).unwrap();
if self.logging_level > 0 {
info!("Evaluating at x = ");
for i in 0..Self::NDIM {
info!(" {:?} ", x[i]);
}
}
fcn_eval[0] = (three - two * x[0]) * x[0] - two * x[1] + F::one();
for i in 1..(Self::NDIM - 1) {
fcn_eval[i] = (three - two * x[i]) * x[i] - x[i - 1] - two * x[i + 1] + F::one();
}
let fcn =
(three - two * x[Self::NDIM - 1]) * x[Self::NDIM - 1] - x[Self::NDIM - 2] + F::one();
fcn_eval[Self::NDIM - 1] = (F::one() - self.lambda) * fcn + self.lambda * fcn * fcn;
if let Some(jac) = opt_jacobian {
assert!(jac.len() >= Self::NDIM * Self::NDIM, "length {:?}", jac.len());
let jacobian = helix_snail::array1d_to_array2d_mut::<{Self::NDIM}, F>(jac);
// zero things out first
for item in jacobian.iter_mut().take(Self::NDIM) {
for val in item.iter_mut() {
*val = F::zero();
}
}
jacobian[0][0] = three - four * x[0];
jacobian[0][1] = -two;
// F(i) = (3-2*x[i])*x[i] - x[i-1] - 2*x[i+1] + 1;
for i in 1..(Self::NDIM - 1) {
jacobian[i][i - 1] = -F::one();
jacobian[i][i] = three - four * x[i];
jacobian[i][i + 1] = -two;
}
let dfndxn = three - four * x[Self::NDIM - 1];
// F(n-1) = ((3-2*x[n-1])*x[n-1] - x[n-2] + 1)^2;
jacobian[Self::NDIM - 1][Self::NDIM - 1] =
(F::one() - self.lambda) * dfndxn + self.lambda * two * dfndxn * fcn;
jacobian[Self::NDIM - 1][Self::NDIM - 2] =
(-F::one() + self.lambda) * F::one() - self.lambda * two * fcn;
}
true
}
}
fn main() {
let _ = env_logger::builder().is_test(true).try_init();
let mut broyden = Broyden::<f64> {
lambda: 0.9999,
logging_level: LOGGING_LEVEL,
};
let dc = TrustRegionDeltaControl::<f64> {
delta_init: 1.0,
..Default::default()
};
let mut solver = TrustRegionDoglegSolver::<f64, Broyden<f64>>::new(&dc, &mut broyden);
for i in 0..Broyden::<f64>::NDIM {
solver.x[i] = 0.0;
}
solver.set_logging_level(Some(LOGGING_LEVEL));
solver.setup_options(Broyden::<f64>::NDIM * 10, 1e-12, Some(LOGGING_LEVEL));
let err = solver.solve();
let status = match err {
Ok(()) => true,
Err(e) => {
error!("Solution did not converge with following error {:?}", e);
false
}
};
assert!(
status == true,
"Solution did not converge"
);
}
Meta
rustc --version --verbose:
rustc 1.95.0-nightly (905b92696 2026-01-31) running on aarch64-apple-darwin
Error output
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests helix_snail
running 1 test
test src/../README.md - (line 22) ... FAILED
failures:
---- src/../README.md - (line 22) stdout ----
error: internal compiler error: /rustc-dev/905b9269674ced4b5239f485609a3bf0ab02d01b/compiler/rustc_symbol_mangling/src/v0.rs:692:42: impossible case reached
thread 'rustc' (2365212) panicked at /rustc-dev/905b9269674ced4b5239f485609a3bf0ab02d01b/compiler/rustc_symbol_mangling/src/v0.rs:692:42:
Box<dyn Any>
stack backtrace:
Backtrace
thread 'rustc' panicked at /rustc-dev/0aced202c24f9356c1640fc0a7f07433b3a7124f/compiler/rustc_symbol_mangling/src/v0.rs:689:42:
Box<dyn Any>
stack backtrace:
0: 0x110821adc - <std[d455e2d6efde72aa]::backtrace::Backtrace>::create
1: 0x10e70892c - std[d455e2d6efde72aa]::panicking::update_hook::<alloc[c55cf4e6360ea6a0]::boxed::Box<rustc_driver_impl[34b24f27153e1ec7]::install_ice_hook::{closure#1}>>::{closure#0}
2: 0x110832a8c - std[d455e2d6efde72aa]::panicking::panic_with_hook
3: 0x10e78b870 - std[d455e2d6efde72aa]::panicking::begin_panic::<rustc_errors[df650342889a42ea]::ExplicitBug>::{closure#0}
4: 0x10e775308 - std[d455e2d6efde72aa]::sys::backtrace::__rust_end_short_backtrace::<std[d455e2d6efde72aa]::panicking::begin_panic<rustc_errors[df650342889a42ea]::ExplicitBug>::{closure#0}, !>
5: 0x1135f654c - std[d455e2d6efde72aa]::panicking::begin_panic::<rustc_errors[df650342889a42ea]::ExplicitBug>
6: 0x1135f7090 - <rustc_errors[df650342889a42ea]::diagnostic::BugAbort as rustc_errors[df650342889a42ea]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
7: 0x1136652c8 - rustc_middle[fcc014112220d8f0]::util::bug::opt_span_bug_fmt::<rustc_span[56432ed8f676b256]::span_encoding::Span>::{closure#0}
8: 0x10f3e0b94 - rustc_middle[fcc014112220d8f0]::ty::context::tls::with_opt::<rustc_middle[fcc014112220d8f0]::util::bug::opt_span_bug_fmt<rustc_span[56432ed8f676b256]::span_encoding::Span>::{closure#0}, !>::{closure#0}
9: 0x10f3ba678 - rustc_middle[fcc014112220d8f0]::ty::context::tls::with_context_opt::<rustc_middle[fcc014112220d8f0]::ty::context::tls::with_opt<rustc_middle[fcc014112220d8f0]::util::bug::opt_span_bug_fmt<rustc_span[56432ed8f676b256]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
10: 0x113669544 - rustc_middle[fcc014112220d8f0]::util::bug::bug_fmt
11: 0x11020ac2c - <rustc_symbol_mangling[4ba2f3151824cc31]::v0::V0SymbolMangler as rustc_middle[fcc014112220d8f0]::ty::print::Printer>::print_const
12: 0x1101ea588 - <rustc_symbol_mangling[4ba2f3151824cc31]::v0::V0SymbolMangler as rustc_middle[fcc014112220d8f0]::ty::print::Printer>::print_path_with_generic_args::<<rustc_symbol_mangling[4ba2f3151824cc31]::v0::V0SymbolMangler as rustc_middle[fcc014112220d8f0]::ty::print::Printer>::default_print_def_path::{closure#0}>
13: 0x11020b56c - <rustc_symbol_mangling[4ba2f3151824cc31]::v0::V0SymbolMangler as rustc_middle[fcc014112220d8f0]::ty::print::Printer>::print_def_path
14: 0x1101f2e40 - rustc_symbol_mangling[4ba2f3151824cc31]::v0::mangle
15: 0x1101eebb8 - rustc_symbol_mangling[4ba2f3151824cc31]::symbol_name_provider
16: 0x10fc68930 - rustc_query_impl[e8bfc12ae5022e0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e8bfc12ae5022e0]::query_impl::symbol_name::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fcc014112220d8f0]::query::erase::Erased<[u8; 16usize]>>
17: 0x10ff5c3bc - <rustc_query_impl[e8bfc12ae5022e0]::query_impl::symbol_name::dynamic_query::{closure#2} as core[a79d29cf7b013110]::ops::function::FnOnce<(rustc_middle[fcc014112220d8f0]::ty::context::TyCtxt, rustc_middle[fcc014112220d8f0]::ty::instance::Instance)>>::call_once
18: 0x10fd040fc - rustc_query_system[44cf950262112cb3]::query::plumbing::try_execute_query::<rustc_query_impl[e8bfc12ae5022e0]::DynamicConfig<rustc_query_system[44cf950262112cb3]::query::caches::DefaultCache<rustc_middle[fcc014112220d8f0]::ty::instance::Instance, rustc_middle[fcc014112220d8f0]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[e8bfc12ae5022e0]::plumbing::QueryCtxt, true>
19: 0x10fdf6420 - rustc_query_impl[e8bfc12ae5022e0]::query_impl::symbol_name::get_query_incr::__rust_end_short_backtrace
20: 0x10f3eef7c - <rustc_middle[fcc014112220d8f0]::mir::mono::MonoItem>::symbol_name
21: 0x10f8781f0 - rustc_monomorphize[3fd0379a00ea4472]::partitioning::assert_symbols_are_distinct::<core[a79d29cf7b013110]::slice::iter::Iter<rustc_middle[fcc014112220d8f0]::mir::mono::MonoItem>>
22: 0x10f8a068c - rustc_monomorphize[3fd0379a00ea4472]::partitioning::collect_and_partition_mono_items
23: 0x10fc6e1c0 - rustc_query_impl[e8bfc12ae5022e0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e8bfc12ae5022e0]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fcc014112220d8f0]::query::erase::Erased<[u8; 24usize]>>
24: 0x10fcb8a94 - rustc_query_system[44cf950262112cb3]::query::plumbing::try_execute_query::<rustc_query_impl[e8bfc12ae5022e0]::DynamicConfig<rustc_query_system[44cf950262112cb3]::query::caches::SingleCache<rustc_middle[fcc014112220d8f0]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[e8bfc12ae5022e0]::plumbing::QueryCtxt, true>
25: 0x10fe24908 - rustc_query_impl[e8bfc12ae5022e0]::query_impl::collect_and_partition_mono_items::get_query_incr::__rust_end_short_backtrace
26: 0x10e2d0f84 - rustc_codegen_ssa[fd32ff40e86d6235]::base::codegen_crate::<rustc_codegen_llvm[69d57827369becac]::LlvmCodegenBackend>
27: 0x10e3b762c - <rustc_codegen_llvm[69d57827369becac]::LlvmCodegenBackend as rustc_codegen_ssa[fd32ff40e86d6235]::traits::backend::CodegenBackend>::codegen_crate
28: 0x10f04cf40 - <rustc_interface[c9d06547c72d79ae]::queries::Linker>::codegen_and_build_linker
29: 0x10e6f7368 - rustc_interface[c9d06547c72d79ae]::passes::create_and_enter_global_ctxt::<core[a79d29cf7b013110]::option::Option<rustc_interface[c9d06547c72d79ae]::queries::Linker>, rustc_driver_impl[34b24f27153e1ec7]::run_compiler::{closure#0}::{closure#2}>
30: 0x10e706e0c - rustc_interface[c9d06547c72d79ae]::interface::run_compiler::<(), rustc_driver_impl[34b24f27153e1ec7]::run_compiler::{closure#0}>::{closure#1}
31: 0x10e6f99f0 - std[d455e2d6efde72aa]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c9d06547c72d79ae]::util::run_in_thread_with_globals<rustc_interface[c9d06547c72d79ae]::util::run_in_thread_pool_with_globals<rustc_interface[c9d06547c72d79ae]::interface::run_compiler<(), rustc_driver_impl[34b24f27153e1ec7]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
32: 0x10e70e4a8 - <std[d455e2d6efde72aa]::thread::lifecycle::spawn_unchecked<rustc_interface[c9d06547c72d79ae]::util::run_in_thread_with_globals<rustc_interface[c9d06547c72d79ae]::util::run_in_thread_pool_with_globals<rustc_interface[c9d06547c72d79ae]::interface::run_compiler<(), rustc_driver_impl[34b24f27153e1ec7]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[a79d29cf7b013110]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
33: 0x11083d5b4 - <std[d455e2d6efde72aa]::sys::thread::unix::Thread>::new::thread_start
34: 0x19b409c08 - __pthread_cond_wait
rustc version: 1.94.0-nightly (0aced202c 2026-01-06)
platform: aarch64-apple-darwin
query stack during panic:
#0 [symbol_name] computing the symbol for `helix_snail::linear_algebra::linear_solvers::lu_solvers::lup_solve::<{const error}, f32>`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the README.md line 22 doctest with the reported nightly compiler and inspect rustc_symbol_mangling/src/v0.rs around V0SymbolMangler::print_const at lines 689-692. Trace the const-generic symbol-mangling path shown in the backtrace; done means the reproducer no longer triggers an internal compiler error and the regression is covered by an appropriate compiler test.
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