Hacker Newsnew | past | comments | ask | show | jobs | submit | saurabh-kushwah's commentslogin

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


To 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.


That's experimental syntax that means something like "maybe const" -- https://github.com/rust-lang/rust/issues/67792


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: