summaryrefslogtreecommitdiffstats
path: root/tests/ui/parser/fn-body-eq-expr-semi.rs
blob: 7127ba8da6148e51beaac5eecf5bf2aeb7b819f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
fn main() {}

fn syntax() {
    fn foo() = 42; //~ ERROR function body cannot be `= expression;`
    fn bar() -> u8 = 42; //~ ERROR function body cannot be `= expression;`
}

extern "C" {
    fn foo() = 42; //~ ERROR function body cannot be `= expression;`
    //~^ ERROR incorrect function inside `extern` block
    fn bar() -> u8 = 42; //~ ERROR function body cannot be `= expression;`
    //~^ ERROR incorrect function inside `extern` block
}

trait Foo {
    fn foo() = 42; //~ ERROR function body cannot be `= expression;`
    fn bar() -> u8 = 42; //~ ERROR function body cannot be `= expression;`
}

impl Foo for () {
    fn foo() = 42; //~ ERROR function body cannot be `= expression;`
    fn bar() -> u8 = 42; //~ ERROR function body cannot be `= expression;`
}