Error constructed but no error reported in generic_const_exprs #89320
Labels
A-const-generics
Area: const generics (parameters and arguments)
C-bug
Category: This is a bug.
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
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.
When using const generics for array lengths, the compiler can emit an ICE if the constraints used are unconventional.
MCVE
The following MCVE emits an ICE on the Nightly compiler on the playground.
Note that the
Clone
derive macro is the source of the error.Background
Originally, my code was somewhat like this:
The compiler provided this message:
I took "add a
where
bound" to mean "give[(); S::N]
a simple constraint", so I addedSized
.The MCVE does not include the
map
field because it is not relevant to the bug itself, I just included it for completeness to show how I arrived at the bug.I still don't really understand why the line is needed at all - I've read through issues like #68366 and rust-lang/compiler-team#340 but can't find an explanation anywhere yet. I assume once this is stabilised it'll get its own entry in the Rustonomicon to help others.
Error output
Backtrace
The text was updated successfully, but these errors were encountered: