Why doesn't `min_const_generics` allow enums without values?

Aren't they just integers? (assuming they derive Eq and PartialEq).

Enums are not integers. Not every integer is a valid enum variant. You can't perform arithmetic on enums.

1 Like

Arithmetic isn't allowed in min_const_generics either. Nor is it at all with characters (I think?)

I think the answer is simply that "min" is trying to find an MVP that can be shipped and stabilized. It's an incomplete set of functionality by nature.

5 Likes

But I think that the reason that full const generics are delayed is a soundness hole, doesn't it? And if enums can't trigger it, what's the problem?

I don't knw about soundness hole. From what I inferred, the biggest problem is lazy normalization (specialization has a soundness hole, though)

You mean, like !? That would have been rather useless in the context of const generics anyway, wouldn't it?

No, I mean an enum that does not carry additional values.

There was an implementation blocker for user-defined types (not the same one that blocks complex expressions) and it wasn't deemed necessary to gate min_const_generics on that issue being resolved.

However, as I wrote in my blog post:

This is a relatively easy shortcoming of the current implementation to fix, and user defined types for const generics will be possible in the nearer, rather than longer term.

That is, its more like async/await not working in no_std than async/await not working in traits. Not part of the MVP but not that distant either.

6 Likes