rust/src/test/parse-fail/extern-no-fn.rs
Georg Brandl b75f81c9b3 parser: do not try to continue with unsafe on foreign fns
The changed line makes it look like `unsafe` is allowed, but the
first statement of `parse_item_foreign_fn` is:

`self.expect_keyword(keywords::Fn)?;`

So we get the strange "expected one of `fn`, `pub`, `static`, or
`unsafe`, found `unsafe`".

Fixes: #27361
2016-05-02 12:49:31 +02:00

19 lines
602 B
Rust

// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: -Z parse-only
extern {
f(); //~ ERROR expected one of `fn`, `pub`, `static`, or `}`, found `f`
}
fn main() {
}