]> git.lizzy.rs Git - rust.git/blob - src/test/ui/parser/fn-body-eq-expr-semi.rs
Account for ADT bodies and struct expressions
[rust.git] / src / test / ui / parser / fn-body-eq-expr-semi.rs
1 fn main() {}
2
3 fn syntax() {
4     fn foo() = 42; //~ ERROR function body cannot be `= expression;`
5     fn bar() -> u8 = 42; //~ ERROR function body cannot be `= expression;`
6 }
7
8 extern "C" {
9     fn foo() = 42; //~ ERROR function body cannot be `= expression;`
10     //~^ ERROR incorrect function inside `extern` block
11     fn bar() -> u8 = 42; //~ ERROR function body cannot be `= expression;`
12     //~^ ERROR incorrect function inside `extern` block
13 }
14
15 trait Foo {
16     fn foo() = 42; //~ ERROR function body cannot be `= expression;`
17     fn bar() -> u8 = 42; //~ ERROR function body cannot be `= expression;`
18 }
19
20 impl Foo for () {
21     fn foo() = 42; //~ ERROR function body cannot be `= expression;`
22     fn bar() -> u8 = 42; //~ ERROR function body cannot be `= expression;`
23 }