]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-fn-mismatch.rs
Rollup merge of #72279 - RalfJung:raw-ref-macros, r=nikomatsakis
[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 {
14         //~^ ERROR functions in traits cannot be declared const
15         22
16     }
17 }
18
19 fn main() {}