Blockers to `const` in traits pre-effects system

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 }
}
2 Likes

It's been a while since I've touched anything close to this, but I'm not aware of any issues that would necessarily pop up if this were to be implemented.

1 Like

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