rust/tests/ui/parser/fn-body-eq-expr-semi.rs
2023-01-11 09:32:08 +00:00

23 lines
770 B
Rust

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;`
}