summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-fn-mismatch.rs
blob: 3107b8128e602f55c125b2eee9c3104470dc43b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 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() {}