Why can't I construct this `const &[u32]`

const SIZES: &[u32] = &[12, 14, 16, 20, 24, 28, 32][..];

Why ca't I do the above? Is there a way to fix this without using lazy_static ?

Just remove the [..] part. Slice indexing is not const-aware yet but the unsize coercion works here.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.