]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-fn-mismatch.rs
Rollup merge of #64603 - gilescope:unused-lifetime-warning, r=matthewjasper
[rust.git] / src / test / ui / consts / const-fn-mismatch.rs
1 // Test that we can't declare a const fn in an impl -- right now it's
2 // just not allowed at all, though eventually it'd make sense to allow
3 // it if the trait fn is const (but right now no trait fns can be
4 // const).
5
6 #![feature(const_fn)]
7
8 trait Foo {
9     fn f() -> u32;
10 }
11
12 impl Foo for u32 {
13     const fn f() -> u32 { 22 }
14     //~^ ERROR trait fns cannot be declared const
15 }
16
17 fn main() { }