rust/tests/ui/consts/const-fn-mismatch.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
400 B
Rust
Raw Normal View History

// 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 {
2024-01-01 23:26:50 +00:00
//~^ ERROR functions in trait impls cannot be declared const
22
}
}
fn main() {}