-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-associated_const_equality`#![feature(associated_const_equality)]``#![feature(associated_const_equality)]`F-min_generic_const_args`#![feature(min_generic_const_args)]``#![feature(min_generic_const_args)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Here is the example code that I found:
#![allow(incomplete_features)]
#![feature(min_generic_const_args)]
pub struct A;
impl A {
#[type_const]
const LEN: usize = 4;
#[allow(unused_braces)]
fn arr() -> [u8; const { Self::LEN }] {
return [0u8; const { Self::LEN }];
}
}
fn main() {
let _ = A::arr();
}This bit of code should compile with no issue, but instead panics with:
thread 'rustc' (2378376) panicked at compiler/rustc_middle/src/ty/generic_args.rs:54:14:
index out of bounds: the len is 0 but the index is 0
I discovered this when working on PR: #150799. I did find a fix, but it would have been too localized from what was described to me, and is more related to the fact that that one of the steps for mGCA #132980 is incomplete:
- Make inherent associated constants behave correctly
I am making this issue as requested by @BoxyUwU here: #150799 (comment)
rustc-ice-2026-01-11T09_57_00-2380279.txt
@rustbot label +F-associated_const_equality +F-min_generic_const_args +I-ICE +T-compiler
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-associated_const_equality`#![feature(associated_const_equality)]``#![feature(associated_const_equality)]`F-min_generic_const_args`#![feature(min_generic_const_args)]``#![feature(min_generic_const_args)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.