Open
Description
I was fluffing around with different generic stuff and ended up enabling the Next-gen solver, where I realized that it looked like Generic Const Expressions just don't work at all.
This code seems to work fine with the default trait solver, but when you enable the -Znext-solver
flag, it throws a normalization error.
#![feature(generic_const_exprs)]
pub struct Vec<T, const N: usize>
where
[T; N * N]: Sized,
{
packed: [T; N * N],
}
I understand this is all very unstable stuff, but thought it was still probably slightly unintended behavior at the least.
Meta
rustc --version --verbose
:
rustc 1.82.0-nightly (100fde524 2024-08-28)
binary: rustc
commit-hash: 100fde5246bf56f22fb5cc85374dd841296fce0e
commit-date: 2024-08-28
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0
Backtrace
error[E0284]: type annotations needed: cannot normalize `Vec<T, N>::packed::{constant#0}`
--> src/main.rs:6:13
|
6 | packed: [T; N * N],
| ^^^^^^^^^^ cannot normalize `Vec<T, N>::packed::{constant#0}`
Metadata
Metadata
Assignees
Labels
Area: const generics (parameters and arguments)Category: This is a bug.`#![feature(generic_const_exprs)]`Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.The Rustc Trait System Refactor Initiative (-Znext-solver)This issue requires the use of incomplete features.