berkus
November 15, 2020, 11:02pm
1
https://doc.rust-lang.org/src/core/convert/num.rs.html#49-54 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
jhpratt
November 16, 2020, 2:40am
3
Well, there is , it's just unstable.
CDirkx
November 16, 2020, 2:35pm
4
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
berkus
November 17, 2020, 6:41pm
5
Could it be enabled behind a feature gate then?
system
Closed
February 15, 2021, 6:41pm
6
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.