Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: feature(generic_const_exprs) when assigning a default value for an array using an associated constant of a supertrait as its size #93248

Closed
teoxoy opened this issue Jan 23, 2022 · 0 comments · Fixed by #96806
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@teoxoy
Copy link

teoxoy commented Jan 23, 2022

Assigning a default value for an array using an associated constant of a supertrait as its size and trying to compile the following code via either cargo run or cargo build results in an ICE.

Code

#![feature(generic_const_exprs)]

trait Padding {
    const PADDING: usize;
}

trait Pad: Padding
where
    [u8; Self::PADDING]:,
{
    // const VAL: [u8; Self::PADDING]; // - works
    const VAL: [u8; Self::PADDING] = [0; Self::PADDING]; // - doesn't work
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.60.0-nightly (bfe156467 2022-01-22)
binary: rustc
commit-hash: bfe15646761a75f0259e204cab071565eed2b1e5
commit-date: 2022-01-22
host: x86_64-pc-windows-msvc
release: 1.60.0-nightly
LLVM version: 13.0.0

Error output

warning: Error finalizing incremental compilation session directory `\\?\<PROJECT_ROOT_(REDACTED)>\target\debug\incremental\<PROJECT_NAME_(REDACTED)>-1f04lwri6wcgv\s-g6dujrhxmd-1dqafbx-working`: The system cannot find the file specified. (os error 2)      

error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<Self as Padding>, [])` during codegen
  |
  = note: delayed at compiler\rustc_trait_selection\src\traits\codegen.rs:68:32

error: internal compiler error: ty::ConstKind::Error constructed but no error reported
  |
  = note: delayed at /rustc/bfe15646761a75f0259e204cab071565eed2b1e5\compiler\rustc_middle\src\ty\consts.rs:245:43

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler\rustc_errors\src\lib.rs:1188:13
Backtrace

(no backtrace generated)

@teoxoy teoxoy added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 23, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jan 26, 2022
@bors bors closed this as completed in cb9cb4d May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants