]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-fn-not-in-trait.rs
Rollup merge of #72279 - RalfJung:raw-ref-macros, r=nikomatsakis
[rust.git] / src / test / ui / consts / const-fn-not-in-trait.rs
1 // Test that const fn is illegal in a trait declaration, whether or
2 // not a default is provided.
3
4 #![feature(const_fn)]
5
6 trait Foo {
7     const fn f() -> u32;
8     //~^ ERROR functions in traits cannot be declared const
9     const fn g() -> u32 {
10         //~^ ERROR functions in traits cannot be declared const
11         0
12     }
13 }
14
15 fn main() {}