Shouldn't simple from() implementations be marked const? code here makes u32::from(u8) to require non-constness, while all it does is (u8 as u32) which compiles fine in const fn.

Shouldn't these blanket impls be marked const? Maybe I'm missing some flag that enables it?

The problem is that we currently have no way at all in Rust to mark methods/functions in traits as const.

1 Like

Well, there is, it's just unstable.

There is indeed impl const Trait for Ty, the unstable implementation of RFC2632. However, that RFC has not been accepted yet, and is implemented purely to explore any issues that might come up with that approach.

1 Like

Could it be enabled behind a feature gate then?

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