rust/tests/ui/consts/const-fn-mismatch.rs
2023-01-11 09:32:08 +00:00

18 lines
395 B
Rust

// Test that we can't declare a const fn in an impl -- right now it's
// just not allowed at all, though eventually it'd make sense to allow
// it if the trait fn is const (but right now no trait fns can be
// const).
trait Foo {
fn f() -> u32;
}
impl Foo for u32 {
const fn f() -> u32 {
//~^ ERROR functions in traits cannot be declared const
22
}
}
fn main() {}