-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Compiler doesn’t allow creating u8 slices when using const generics #145376
Copy link
Copy link
Open
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-repr-packedArea: the naughtiest reprArea: the naughtiest reprA-sliceArea: `[T]`Area: `[T]`C-bugCategory: This is a bug.Category: This is a bug.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.
Metadata
Metadata
Assignees
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-repr-packedArea: the naughtiest reprArea: the naughtiest reprA-sliceArea: `[T]`Area: `[T]`C-bugCategory: This is a bug.Category: This is a bug.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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
This compiles:
But if I use const generics it doesn’t anymore:
I get the error:
Since u8 slices have an alignment of 1 (for all values of CAPACITY) and the first code block works, I think the second one should too.
Meta
rustc --version --verbose: