]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/const-fn-mismatch.rs
suggest fix for attempted integer identifier in patterns
[rust.git] / tests / 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 trait Foo {
7     fn f() -> u32;
8 }
9
10 impl Foo for u32 {
11     const fn f() -> u32 {
12         //~^ ERROR functions in traits cannot be declared const
13         22
14     }
15 }
16
17 fn main() {}