4 ms·
Similar to constant generics, any idea what `~const` means ? I can see some references in the source code, https://doc.rust-lang.org/src/core/result.rs.html#20
by saurabh-kushwah 4y ago
Similar to constant generics, any idea what `~const` means ?
I can see some references in the source code, https://doc.rust-lang.org/src/core/result.rs.html#2057 https://doc.rust-lang.org/src/core/result.rs.html#2057
- CUViper 4y agoThat's experimental syntax that means something like "maybe const" -- https://github.com/rust-lang/rust/issues/67792 https://github.com/rust-lang/rust/issues/67792
- conradludgate 4y agoTo elaborate on what CUViper said, const functions are really 'maybe const' functions since they can be called with runtime arguments or compile time arguments. If you want your const function to depend on some trait, for it to even be possible at compile time, those traits would need to be possible to use at compile time too. But the same idea holds as arguments, we might just want to use it at runtime too, in which case it needs to be a 'maybe const' bound for the const function to be flexible enough for us.