[ICE]: SIGSEGV when using a trait's contant on another trait's associated type with an associated type with a life-time
Open
Nobody has claimed this yet.
C-bug
F-generic_const_exprs
I-ICE
needs-triage
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
pub trait Creator {
type Ctx<const COUNT: usize>: Context;
}
pub trait Context {
type Element<'a>
where
Self: 'a;
fn process(f: impl FnOnce(Self::Element<'_>));
}
pub trait Config {
const COUNT: usize;
}
fn foo<Cfg, Crt>()
where
Cfg: Config,
Crt: Creator,
[(); Cfg::COUNT]:,
{
// using an ordinary constant dose not invoke an ICE
//Crt::Ctx::<4>::process(|c| ())
// removing the function invocation makes the ICE disappear
Crt::Ctx::<{ Cfg::COUNT }>::process(|c| ())
}
See on Playground
Meta
rustc --version --verbose:
rustc 1.96.0-nightly (fda6d37bb 2026-03-27)
binary: rustc
commit-hash: fda6d37bb88ee12fd50fa54d15859f1f91b74f55
commit-date: 2026-03-27
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.2
Error output
error: rustc interrupted by SIGSEGV, printing backtrace
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(+0x3b84cac)[0x70dbe4984cac]
/lib/x86_64-linux-gnu/libc.so.6(+0x45330)[0x70dbe0a45330]
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(_RNvXNtNtNtCs1JE6Yim7qlX_11rustc_infer5infer9canonical11instantiateNtB2_21CanonicalInstantiatorINtNtCs7VJwPuHzCY1_13rustc_type_ir4fold10TypeFolderNtNtNtCslQsBjEdtCuf_12rustc_middle2ty7context6TyCtxtE7fold_ty+0x17)[0x70dbe643e4d7]
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(_RNvXNtNtNtCs1JE6Yim7qlX_11rustc_infer5infer9canonical11instantiateNtB2_21CanonicalInstantiatorINtNtCs7VJwPuHzCY1_13rustc_type_ir4fold10TypeFolderNtNtNtCslQsBjEdtCuf_12rustc_middle2ty7context6TyCtxtE7fold_ty+0x1389)[0x70dbe643f849]
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(+0x54703e6)[0x70dbe62703e6]
### cycle encountered after 5 frames with period 6
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(_RNvXs_NtNtNtCs6IE9M1PiXPM_21rustc_trait_selection6traits5query9normalizeNtB4_15QueryNormalizerINtNtCs7VJwPuHzCY1_13rustc_type_ir4fold18FallibleTypeFolderNtNtNtCslQsBjEdtCuf_12rustc_middle2ty7context6TyCtxtE11try_fold_ty+0x1e2)[0x70dbe626ef62]
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(+0x5471b7e)[0x70dbe6271b7e]
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(_RNvXs_NtNtNtCs6IE9M1PiXPM_21rustc_trait_selection6traits5query9normalizeNtB4_15QueryNormalizerINtNtCs7VJwPuHzCY1_13rustc_type_ir4fold18FallibleTypeFolderNtNtNtCslQsBjEdtCuf_12rustc_middle2ty7context6TyCtxtE11try_fold_ty+0x1e2)[0x70dbe626ef62]
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(+0x5471b7e)[0x70dbe6271b7e]
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(_RNvXs_NtNtNtCs6IE9M1PiXPM_21rustc_trait_selection6traits5query9normalizeNtB4_15QueryNormalizerINtNtCs7VJwPuHzCY1_13rustc_type_ir4fold18FallibleTypeFolderNtNtNtCslQsBjEdtCuf_12rustc_middle2ty7context6TyCtxtE11try_fold_ty+0x1e2)[0x70dbe626ef62]
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(+0x5471b7e)[0x70dbe6271b7e]
### recursed 41 times
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(_RNvXs_NtNtNtCs6IE9M1PiXPM_21rustc_trait_selection6traits5query9normalizeNtB4_15QueryNormalizerINtNtCs7VJwPuHzCY1_13rustc_type_ir4fold18FallibleTypeFolderNtNtNtCslQsBjEdtCuf_12rustc_middle2ty7context6TyCtxtE11try_fold_ty+0x1e2)[0x70dbe626ef62]
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(+0x5471b7e)[0x70dbe6271b7e]
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(_RNvXs_NtNtNtCs6IE9M1PiXPM_21rustc_trait_selection6traits5query9normalizeNtB4_15QueryNormalizerINtNtCs7VJwPuHzCY1_13rustc_type_ir4fold18FallibleTypeFolderNtNtNtCslQsBjEdtCuf_12rustc_middle2ty7context6TyCtxtE11try_fold_ty+0x1e2)[0x70dbe626ef62]
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(+0x5471b7e)[0x70dbe6271b7e]
/home/cryptjar/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-3e378010a495f95d.so(_RNvXs_NtNtNtCs6IE9M1PiXPM_21rustc_trait_selection6traits5query9normalizeNtB4_15QueryNormalizerINtNtCs7VJwPuHzCY1_13rustc_type_ir4fold18FallibleTypeFolderNtNtNtCslQsBjEdtCuf_12rustc_middle2ty7context6TyCtxtE11try_fold_ty+0x1e2)[0x70dbe626ef62]
note: rustc unexpectedly overflowed its stack! this is a bug
note: maximum backtrace depth reached, frames may have been lost
note: we would appreciate a report at https://github.com/rust-lang/rust
help: you can increase rustc's stack size by setting RUST_MIN_STACK=16777216
note: backtrace dumped due to SIGSEGV! resuming signal
[1] 759974 segmentation fault (core dumped) rustc src/lib.rs --crate-type lib
Setting RUST_MIN_STACK=16777216 does not appear to make any difference.
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
Start by compiling the minimal reproducer in src/lib.rs with the nightly toolchain and compare the constant and associated-type cases. Trace the normalization and instantiation frames shown in the stack overflow; done means the example no longer causes recursive overflow or SIGSEGV while preserving the reported behavior.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100