"Type annotations needed" and ICE with const generics and specialization #72821
Labels
A-const-generics
Area: const generics (parameters and arguments)
A-specialization
Area: Trait impl specialization
C-bug
Category: This is a bug.
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
F-specialization
`#![feature(specialization)]`
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The usage of const-generic types with specialization started to cause errors since nightly-2020-05-20 (rustc 2020-05-19).
All the following samples build successfully and work with nightly-2020-05-19 toolchain (rustc 2020-05-18) and earlier.
Code
Complete on playground
Gives the error:
To raise an error the const parameter (
VAL
) may be used in const expression in any way except "path statement" likeUseSmallInt<{VAL; true}>
. So this fails to compile too (playground):ICE case
The ICE is encountered in a special case (playground):
Error:
The ICE raises when the last field in
IntermediateStruct
is not a const-generic-with-specialization member. If the field order is opposite, the general "type annotations needed" is reported (playground):Meta
rustc --version --verbose
for nightly-2020-05-19:rustc --version --verbose
for nightly-2020-05-20:The text was updated successfully, but these errors were encountered: