rust/src/test/ui/suggestions/suggest-semicolon-for-fn-in-extern-block.rs
Michael Howell 6611567f9e Expect extern fn with no body when parsing
Also add a test case for inserting a semicolon on extern fns.

Without this fix, we got an error like this:

    error: expected one of `->`, `where`, or `{`, found `}`
     --> chk.rs:3:1
      |
    2 |   fn foo()
      |      ---  - expected one of `->`, `where`, or `{`
      |      |
      |      while parsing this `fn`
    3 | }
      | ^ unexpected token

Since this is inside an extern block, you're required to write function
prototypes with no body. This fixes a regression, and adds a test case
for it.
2021-12-06 11:16:46 -07:00

10 lines
99 B
Rust

// run-rustfix
#[allow(dead_code)]
extern "C" {
fn foo() //~ERROR expected `;`
}
fn main() {}