]> git.lizzy.rs Git - rust.git/blob - tests/ui/parser/fn-body-optional-semantic-fail.rs
Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup
[rust.git] / tests / ui / parser / fn-body-optional-semantic-fail.rs
1 // Tests the different rules for `fn` forms requiring the presence or lack of a body.
2
3 fn main() {
4     fn f1(); //~ ERROR free function without a body
5     fn f2() {} // OK.
6
7     trait X {
8         fn f1(); // OK.
9         fn f2() {} // OK.
10     }
11
12     struct Y;
13     impl X for Y {
14         fn f1(); //~ ERROR associated function in `impl` without body
15         fn f2() {} // OK.
16     }
17
18     impl Y {
19         fn f3(); //~ ERROR associated function in `impl` without body
20         fn f4() {} // OK.
21     }
22
23     extern "C" {
24         fn f5(); // OK.
25         fn f6() {} //~ ERROR incorrect function inside `extern` block
26     }
27 }