What are the issues with allowing const
functions in traits saying that any implementation must be const
?
I know that the effects system will allow traits themselves to be optionally const, but I am struggling to see any potential conflict with strictly const functions. This as a whole seems less error-prone than async_fn_in_trait
.
trait Foo {
const fn bar() -> i32;
}
// Okay
impl Foo for Qux {
const fn bar() -> i32 { 10 + 10 }
}
// Fail
impl Foo for Quux {
fn bar() -> i32 { 10 + 10 }
}