parser: fuse free fn parsing together.
This commit is contained in:
parent
36a17e4067
commit
a833be2162
28 changed files with 181 additions and 185 deletions
|
|
@ -2,4 +2,4 @@
|
|||
// compile-flags: --crate-type lib
|
||||
|
||||
pub async const fn x() {}
|
||||
//~^ ERROR expected one of `fn` or `unsafe`, found keyword `const`
|
||||
//~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `const`
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: expected one of `fn` or `unsafe`, found keyword `const`
|
||||
error: expected one of `extern`, `fn`, or `unsafe`, found keyword `const`
|
||||
--> $DIR/no-async-const.rs:4:11
|
||||
|
|
||||
LL | pub async const fn x() {}
|
||||
| ^^^^^ expected one of `fn` or `unsafe`
|
||||
| ^^^^^ expected one of `extern`, `fn`, or `unsafe`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,5 +2,4 @@
|
|||
// compile-flags: --crate-type lib
|
||||
|
||||
pub const async fn x() {}
|
||||
//~^ ERROR expected identifier, found keyword `async`
|
||||
//~^^ expected `:`, found keyword `fn`
|
||||
//~^ ERROR functions cannot be both `const` and `async`
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
error: expected identifier, found keyword `async`
|
||||
--> $DIR/no-const-async.rs:4:11
|
||||
error: functions cannot be both `const` and `async`
|
||||
--> $DIR/no-const-async.rs:4:1
|
||||
|
|
||||
LL | pub const async fn x() {}
|
||||
| ^^^^^ expected identifier, found keyword
|
||||
| ^^^^-----^-----^^^^^^^^^^
|
||||
| | |
|
||||
| | `async` because of this
|
||||
| `const` because of this
|
||||
|
||||
error: expected `:`, found keyword `fn`
|
||||
--> $DIR/no-const-async.rs:4:17
|
||||
|
|
||||
LL | pub const async fn x() {}
|
||||
| ^^ expected `:`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -8,4 +8,4 @@ impl S {
|
|||
}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
unsafe async fn f() {} //~ ERROR expected one of `extern`, `fn`, or `{`, found keyword `async`
|
||||
unsafe async fn f() {} //~ ERROR expected one of `extern` or `fn`, found keyword `async`
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ error: expected one of `extern` or `fn`, found keyword `async`
|
|||
LL | unsafe async fn g() {}
|
||||
| ^^^^^ expected one of `extern` or `fn`
|
||||
|
||||
error: expected one of `extern`, `fn`, or `{`, found keyword `async`
|
||||
error: expected one of `extern` or `fn`, found keyword `async`
|
||||
--> $DIR/no-unsafe-async.rs:11:8
|
||||
|
|
||||
LL | unsafe async fn f() {}
|
||||
| ^^^^^ expected one of `extern`, `fn`, or `{`
|
||||
| ^^^^^ expected one of `extern` or `fn`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
// Check that `const extern fn` and `const unsafe extern fn` are feature-gated.
|
||||
|
||||
#[cfg(FALSE)] const extern fn foo1() {} //~ ERROR `const extern fn` definitions are unstable
|
||||
#[cfg(FALSE)] const extern "C" fn foo2() {} //~ ERROR `const extern fn` definitions are unstable
|
||||
#[cfg(FALSE)] const extern "Rust" fn foo3() {} //~ ERROR `const extern fn` definitions are unstable
|
||||
#[cfg(FALSE)] const unsafe extern fn bar1() {} //~ ERROR `const extern fn` definitions are unstable
|
||||
#[cfg(FALSE)] const unsafe extern "C" fn bar2() {}
|
||||
//~^ ERROR `const extern fn` definitions are unstable
|
||||
#[cfg(FALSE)] const unsafe extern "Rust" fn bar3() {}
|
||||
//~^ ERROR `const extern fn` definitions are unstable
|
||||
const extern fn foo1() {} //~ ERROR `const extern fn` definitions are unstable
|
||||
const extern "C" fn foo2() {} //~ ERROR `const extern fn` definitions are unstable
|
||||
const extern "Rust" fn foo3() {} //~ ERROR `const extern fn` definitions are unstable
|
||||
const unsafe extern fn bar1() {} //~ ERROR `const extern fn` definitions are unstable
|
||||
const unsafe extern "C" fn bar2() {} //~ ERROR `const extern fn` definitions are unstable
|
||||
const unsafe extern "Rust" fn bar3() {} //~ ERROR `const extern fn` definitions are unstable
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,53 +1,53 @@
|
|||
error[E0658]: `const extern fn` definitions are unstable
|
||||
--> $DIR/feature-gate-const_extern_fn.rs:3:15
|
||||
--> $DIR/feature-gate-const_extern_fn.rs:3:1
|
||||
|
|
||||
LL | #[cfg(FALSE)] const extern fn foo1() {}
|
||||
| ^^^^^^^^^^^^
|
||||
LL | const extern fn foo1() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information
|
||||
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: `const extern fn` definitions are unstable
|
||||
--> $DIR/feature-gate-const_extern_fn.rs:4:15
|
||||
--> $DIR/feature-gate-const_extern_fn.rs:4:1
|
||||
|
|
||||
LL | #[cfg(FALSE)] const extern "C" fn foo2() {}
|
||||
| ^^^^^^^^^^^^
|
||||
LL | const extern "C" fn foo2() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information
|
||||
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: `const extern fn` definitions are unstable
|
||||
--> $DIR/feature-gate-const_extern_fn.rs:5:15
|
||||
--> $DIR/feature-gate-const_extern_fn.rs:5:1
|
||||
|
|
||||
LL | #[cfg(FALSE)] const extern "Rust" fn foo3() {}
|
||||
| ^^^^^^^^^^^^
|
||||
LL | const extern "Rust" fn foo3() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information
|
||||
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: `const extern fn` definitions are unstable
|
||||
--> $DIR/feature-gate-const_extern_fn.rs:6:15
|
||||
--> $DIR/feature-gate-const_extern_fn.rs:6:1
|
||||
|
|
||||
LL | #[cfg(FALSE)] const unsafe extern fn bar1() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
LL | const unsafe extern fn bar1() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information
|
||||
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: `const extern fn` definitions are unstable
|
||||
--> $DIR/feature-gate-const_extern_fn.rs:7:15
|
||||
--> $DIR/feature-gate-const_extern_fn.rs:7:1
|
||||
|
|
||||
LL | #[cfg(FALSE)] const unsafe extern "C" fn bar2() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
LL | const unsafe extern "C" fn bar2() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information
|
||||
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: `const extern fn` definitions are unstable
|
||||
--> $DIR/feature-gate-const_extern_fn.rs:9:15
|
||||
--> $DIR/feature-gate-const_extern_fn.rs:8:1
|
||||
|
|
||||
LL | #[cfg(FALSE)] const unsafe extern "Rust" fn bar3() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
LL | const unsafe extern "Rust" fn bar3() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information
|
||||
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable
|
||||
|
|
|
|||
|
|
@ -4,5 +4,4 @@ fn main() {}
|
|||
fn container() {
|
||||
const extern "Rust" PUT_ANYTHING_YOU_WANT_HERE bug() -> usize { 1 }
|
||||
//~^ ERROR expected `fn`
|
||||
//~| ERROR `const extern fn` definitions are unstable
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,5 @@ error: expected `fn`, found `PUT_ANYTHING_YOU_WANT_HERE`
|
|||
LL | const extern "Rust" PUT_ANYTHING_YOU_WANT_HERE bug() -> usize { 1 }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `fn`
|
||||
|
||||
error[E0658]: `const extern fn` definitions are unstable
|
||||
--> $DIR/issue-68062-const-extern-fns-dont-need-fn-specifier.rs:5:5
|
||||
|
|
||||
LL | const extern "Rust" PUT_ANYTHING_YOU_WANT_HERE bug() -> usize { 1 }
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information
|
||||
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable
|
||||
error: aborting due to previous error
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
// These are forbidden occurrences of label-break-value
|
||||
|
||||
fn labeled_unsafe() {
|
||||
unsafe 'b: {} //~ ERROR expected one of `extern`, `fn`, or `{`
|
||||
unsafe 'b: {} //~ ERROR expected `{`, found `'b`
|
||||
}
|
||||
|
||||
fn labeled_if() {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: expected one of `extern`, `fn`, or `{`, found `'b`
|
||||
error: expected `{`, found `'b`
|
||||
--> $DIR/label_break_value_illegal_uses.rs:6:12
|
||||
|
|
||||
LL | unsafe 'b: {}
|
||||
| ^^ expected one of `extern`, `fn`, or `{`
|
||||
| ^^ expected `{`
|
||||
|
||||
error: expected `{`, found `'b`
|
||||
--> $DIR/label_break_value_illegal_uses.rs:10:13
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
extern crte foo; //~ ERROR expected one of `crate`, `fn`, or `{`, found `crte`
|
||||
extern crte foo; //~ ERROR expected one of `crate` or `{`, found `crte`
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: expected one of `crate`, `fn`, or `{`, found `crte`
|
||||
error: expected one of `crate` or `{`, found `crte`
|
||||
--> $DIR/extern-crate-unexpected-token.rs:1:8
|
||||
|
|
||||
LL | extern crte foo;
|
||||
| ^^^^ expected one of `crate`, `fn`, or `{`
|
||||
| ^^^^ expected one of `crate` or `{`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
// Verifies that the expected token errors for `extern crate` are
|
||||
// raised
|
||||
// Verifies that the expected token errors for `extern crate` are raised.
|
||||
|
||||
extern "C" mod foo; //~ERROR expected one of `fn` or `{`, found keyword `mod`
|
||||
extern "C" mod foo; //~ERROR expected `{`, found keyword `mod`
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: expected one of `fn` or `{`, found keyword `mod`
|
||||
--> $DIR/extern-expected-fn-or-brace.rs:4:12
|
||||
error: expected `{`, found keyword `mod`
|
||||
--> $DIR/extern-expected-fn-or-brace.rs:3:12
|
||||
|
|
||||
LL | extern "C" mod foo;
|
||||
| ^^^ expected one of `fn` or `{`
|
||||
| ^^^ expected `{`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ fn main() {
|
|||
unsafe fn ff2() {} // OK.
|
||||
const fn ff3() {} // OK.
|
||||
extern "C" fn ff4() {} // OK.
|
||||
const /* async */ unsafe extern "C" fn ff5() {} // OK.
|
||||
//^ FIXME(Centril): `async` should be legal syntactically, ensure it's illegal semantically.
|
||||
const async unsafe extern "C" fn ff5() {} // OK.
|
||||
//~^ ERROR functions cannot be both `const` and `async`
|
||||
|
||||
trait X {
|
||||
async fn ft1(); //~ ERROR trait fns cannot be declared `async`
|
||||
|
|
@ -21,6 +21,7 @@ fn main() {
|
|||
const async unsafe extern "C" fn ft5();
|
||||
//~^ ERROR trait fns cannot be declared `async`
|
||||
//~| ERROR trait fns cannot be declared const
|
||||
//~| ERROR functions cannot be both `const` and `async`
|
||||
}
|
||||
|
||||
struct Y;
|
||||
|
|
@ -34,6 +35,7 @@ fn main() {
|
|||
//~^ ERROR trait fns cannot be declared `async`
|
||||
//~| ERROR trait fns cannot be declared const
|
||||
//~| ERROR method `ft5` has an incompatible type for trait
|
||||
//~| ERROR functions cannot be both `const` and `async`
|
||||
}
|
||||
|
||||
impl Y {
|
||||
|
|
@ -41,7 +43,8 @@ fn main() {
|
|||
unsafe fn fi2() {} // OK.
|
||||
const fn fi3() {} // OK.
|
||||
extern "C" fn fi4() {} // OK.
|
||||
const async unsafe extern "C" fn fi5() {} // OK.
|
||||
const async unsafe extern "C" fn fi5() {}
|
||||
//~^ ERROR functions cannot be both `const` and `async`
|
||||
}
|
||||
|
||||
extern {
|
||||
|
|
@ -50,5 +53,6 @@ fn main() {
|
|||
const fn fe3(); //~ ERROR functions in `extern` blocks cannot have qualifiers
|
||||
extern "C" fn fe4(); //~ ERROR functions in `extern` blocks cannot have qualifiers
|
||||
const async unsafe extern "C" fn fe5(); //~ ERROR functions in `extern` blocks
|
||||
//~^ ERROR functions cannot be both `const` and `async`
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
error: functions cannot be both `const` and `async`
|
||||
--> $DIR/fn-header-semantic-fail.rs:13:5
|
||||
|
|
||||
LL | const async unsafe extern "C" fn ff5() {} // OK.
|
||||
| -----^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| | |
|
||||
| | `async` because of this
|
||||
| `const` because of this
|
||||
|
||||
error[E0706]: trait fns cannot be declared `async`
|
||||
--> $DIR/fn-header-semantic-fail.rs:17:9
|
||||
|
|
||||
|
|
@ -32,8 +41,17 @@ LL | const async unsafe extern "C" fn ft5();
|
|||
= note: `async` trait functions are not currently supported
|
||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||
|
||||
error: functions cannot be both `const` and `async`
|
||||
--> $DIR/fn-header-semantic-fail.rs:21:9
|
||||
|
|
||||
LL | const async unsafe extern "C" fn ft5();
|
||||
| -----^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| | |
|
||||
| | `async` because of this
|
||||
| `const` because of this
|
||||
|
||||
error[E0706]: trait fns cannot be declared `async`
|
||||
--> $DIR/fn-header-semantic-fail.rs:28:9
|
||||
--> $DIR/fn-header-semantic-fail.rs:29:9
|
||||
|
|
||||
LL | async fn ft1() {}
|
||||
| -----^^^^^^^^^^^^
|
||||
|
|
@ -44,19 +62,19 @@ LL | async fn ft1() {}
|
|||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||
|
||||
error[E0379]: trait fns cannot be declared const
|
||||
--> $DIR/fn-header-semantic-fail.rs:31:9
|
||||
--> $DIR/fn-header-semantic-fail.rs:32:9
|
||||
|
|
||||
LL | const fn ft3() {}
|
||||
| ^^^^^ trait fns cannot be const
|
||||
|
||||
error[E0379]: trait fns cannot be declared const
|
||||
--> $DIR/fn-header-semantic-fail.rs:33:9
|
||||
--> $DIR/fn-header-semantic-fail.rs:34:9
|
||||
|
|
||||
LL | const async unsafe extern "C" fn ft5() {}
|
||||
| ^^^^^ trait fns cannot be const
|
||||
|
||||
error[E0706]: trait fns cannot be declared `async`
|
||||
--> $DIR/fn-header-semantic-fail.rs:33:9
|
||||
--> $DIR/fn-header-semantic-fail.rs:34:9
|
||||
|
|
||||
LL | const async unsafe extern "C" fn ft5() {}
|
||||
| ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -66,8 +84,26 @@ LL | const async unsafe extern "C" fn ft5() {}
|
|||
= note: `async` trait functions are not currently supported
|
||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||
|
||||
error: functions cannot be both `const` and `async`
|
||||
--> $DIR/fn-header-semantic-fail.rs:34:9
|
||||
|
|
||||
LL | const async unsafe extern "C" fn ft5() {}
|
||||
| -----^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| | |
|
||||
| | `async` because of this
|
||||
| `const` because of this
|
||||
|
||||
error: functions cannot be both `const` and `async`
|
||||
--> $DIR/fn-header-semantic-fail.rs:46:9
|
||||
|
|
||||
LL | const async unsafe extern "C" fn fi5() {}
|
||||
| -----^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| | |
|
||||
| | `async` because of this
|
||||
| `const` because of this
|
||||
|
||||
error: functions in `extern` blocks cannot have qualifiers
|
||||
--> $DIR/fn-header-semantic-fail.rs:48:18
|
||||
--> $DIR/fn-header-semantic-fail.rs:51:18
|
||||
|
|
||||
LL | extern {
|
||||
| ------ in this `extern` block
|
||||
|
|
@ -77,7 +113,7 @@ LL | async fn fe1();
|
|||
| help: remove the qualifiers: `fn`
|
||||
|
||||
error: functions in `extern` blocks cannot have qualifiers
|
||||
--> $DIR/fn-header-semantic-fail.rs:49:19
|
||||
--> $DIR/fn-header-semantic-fail.rs:52:19
|
||||
|
|
||||
LL | extern {
|
||||
| ------ in this `extern` block
|
||||
|
|
@ -88,7 +124,7 @@ LL | unsafe fn fe2();
|
|||
| help: remove the qualifiers: `fn`
|
||||
|
||||
error: functions in `extern` blocks cannot have qualifiers
|
||||
--> $DIR/fn-header-semantic-fail.rs:50:18
|
||||
--> $DIR/fn-header-semantic-fail.rs:53:18
|
||||
|
|
||||
LL | extern {
|
||||
| ------ in this `extern` block
|
||||
|
|
@ -99,7 +135,7 @@ LL | const fn fe3();
|
|||
| help: remove the qualifiers: `fn`
|
||||
|
||||
error: functions in `extern` blocks cannot have qualifiers
|
||||
--> $DIR/fn-header-semantic-fail.rs:51:23
|
||||
--> $DIR/fn-header-semantic-fail.rs:54:23
|
||||
|
|
||||
LL | extern {
|
||||
| ------ in this `extern` block
|
||||
|
|
@ -110,7 +146,7 @@ LL | extern "C" fn fe4();
|
|||
| help: remove the qualifiers: `fn`
|
||||
|
||||
error: functions in `extern` blocks cannot have qualifiers
|
||||
--> $DIR/fn-header-semantic-fail.rs:52:42
|
||||
--> $DIR/fn-header-semantic-fail.rs:55:42
|
||||
|
|
||||
LL | extern {
|
||||
| ------ in this `extern` block
|
||||
|
|
@ -120,8 +156,17 @@ LL | const async unsafe extern "C" fn fe5();
|
|||
| |
|
||||
| help: remove the qualifiers: `fn`
|
||||
|
||||
error: functions cannot be both `const` and `async`
|
||||
--> $DIR/fn-header-semantic-fail.rs:55:9
|
||||
|
|
||||
LL | const async unsafe extern "C" fn fe5();
|
||||
| -----^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| | |
|
||||
| | `async` because of this
|
||||
| `const` because of this
|
||||
|
||||
error[E0053]: method `ft1` has an incompatible type for trait
|
||||
--> $DIR/fn-header-semantic-fail.rs:28:24
|
||||
--> $DIR/fn-header-semantic-fail.rs:29:24
|
||||
|
|
||||
LL | async fn ft1();
|
||||
| - type in trait
|
||||
|
|
@ -136,7 +181,7 @@ LL | async fn ft1() {}
|
|||
found fn pointer `fn() -> impl std::future::Future`
|
||||
|
||||
error[E0053]: method `ft5` has an incompatible type for trait
|
||||
--> $DIR/fn-header-semantic-fail.rs:33:48
|
||||
--> $DIR/fn-header-semantic-fail.rs:34:48
|
||||
|
|
||||
LL | const async unsafe extern "C" fn ft5();
|
||||
| - type in trait
|
||||
|
|
@ -150,7 +195,7 @@ LL | const async unsafe extern "C" fn ft5() {}
|
|||
= note: expected fn pointer `unsafe extern "C" fn()`
|
||||
found fn pointer `unsafe extern "C" fn() -> impl std::future::Future`
|
||||
|
||||
error: aborting due to 15 previous errors
|
||||
error: aborting due to 20 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0053, E0379, E0706.
|
||||
For more information about an error, try `rustc --explain E0053`.
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
// check-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(const_extern_fn)]
|
||||
//^ FIXME(Centril): move check to ast_validation.
|
||||
|
||||
fn main() {}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
|
|
@ -14,8 +11,7 @@ fn syntax() {
|
|||
unsafe fn f();
|
||||
const fn f();
|
||||
extern "C" fn f();
|
||||
const /* async */ unsafe extern "C" fn f();
|
||||
//^ FIXME(Centril): `async` should be legal syntactically.
|
||||
const async unsafe extern "C" fn f();
|
||||
|
||||
trait X {
|
||||
async fn f();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
trait T {
|
||||
extern "Rust" unsafe fn foo(); //~ ERROR expected `fn`, found keyword `unsafe`
|
||||
extern "Rust" unsafe fn foo(); //~ ERROR expected one of `async`, `const`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
error: expected `fn`, found keyword `unsafe`
|
||||
--> $DIR/issue-19398.rs:2:19
|
||||
error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found keyword `extern`
|
||||
--> $DIR/issue-19398.rs:2:5
|
||||
|
|
||||
LL | trait T {
|
||||
| - expected one of 10 possible tokens
|
||||
LL | extern "Rust" unsafe fn foo();
|
||||
| ^^^^^^ expected `fn`
|
||||
| ^^^^^^ unexpected token
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@ fn main() {
|
|||
std::mem::transmute::<f32, u32>(1.0);
|
||||
//}
|
||||
}
|
||||
//~^^^ ERROR expected one of `extern`, `fn`, or `{`, found `std`
|
||||
//~^^^ ERROR expected `{`, found `std`
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: expected one of `extern`, `fn`, or `{`, found `std`
|
||||
error: expected `{`, found `std`
|
||||
--> $DIR/unsafe-block-without-braces.rs:3:9
|
||||
|
|
||||
LL | unsafe //{
|
||||
| - expected one of `extern`, `fn`, or `{`
|
||||
| - expected `{`
|
||||
LL | std::mem::transmute::<f32, u32>(1.0);
|
||||
| ^^^ unexpected token
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue