summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const-fn-not-in-trait.rs
blob: 00bae3f3b99e0d36e849c74b64d1bc4f0e7c3bc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Test that const fn is illegal in a trait declaration, whether or
// not a default is provided, and even with the feature gate.

trait Foo {
    const fn f() -> u32;
    //~^ ERROR functions in traits cannot be declared const
    const fn g() -> u32 {
        //~^ ERROR functions in traits cannot be declared const
        0
    }
}

fn main() {}