parser_fn_front_matter: allow const .. extern
This commit is contained in:
parent
c30f068dc8
commit
36a17e4067
7 changed files with 106 additions and 109 deletions
|
|
@ -6,6 +6,5 @@ trait T {
|
|||
});
|
||||
//~^ ERROR expected one of `async`
|
||||
//~| ERROR expected one of `.`, `;`, `?`, `else`, or an operator, found `}`
|
||||
//~| ERROR expected identifier, found `;`
|
||||
Some(4)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,5 @@ LL | let _ = if true {
|
|||
LL | });
|
||||
| ^ help: `}` may belong here
|
||||
|
||||
error: expected identifier, found `;`
|
||||
--> $DIR/issue-60075.rs:6:11
|
||||
|
|
||||
LL | });
|
||||
| ^ expected identifier
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ fn main() {
|
|||
unsafe fn ft2(); // OK.
|
||||
const fn ft3(); //~ ERROR trait fns cannot be declared const
|
||||
extern "C" fn ft4(); // OK.
|
||||
/* const */ async unsafe extern "C" fn ft5();
|
||||
const async unsafe extern "C" fn ft5();
|
||||
//~^ ERROR trait fns cannot be declared `async`
|
||||
//^ FIXME(Centril): `const` should be legal syntactically, ensure it's illegal semantically.
|
||||
//~| ERROR trait fns cannot be declared const
|
||||
}
|
||||
|
||||
struct Y;
|
||||
|
|
@ -30,10 +30,10 @@ fn main() {
|
|||
unsafe fn ft2() {} // OK.
|
||||
const fn ft3() {} //~ ERROR trait fns cannot be declared const
|
||||
extern "C" fn ft4() {}
|
||||
/* const */ async unsafe extern "C" fn ft5() {}
|
||||
const async unsafe extern "C" fn ft5() {}
|
||||
//~^ ERROR trait fns cannot be declared `async`
|
||||
//~| ERROR trait fns cannot be declared const
|
||||
//~| ERROR method `ft5` has an incompatible type for trait
|
||||
//^ FIXME(Centril): `const` should be legal syntactically, ensure it's illegal semantically.
|
||||
}
|
||||
|
||||
impl Y {
|
||||
|
|
@ -41,8 +41,7 @@ fn main() {
|
|||
unsafe fn fi2() {} // OK.
|
||||
const fn fi3() {} // OK.
|
||||
extern "C" fn fi4() {} // OK.
|
||||
/* const */ async unsafe extern "C" fn fi5() {} // OK.
|
||||
//^ FIXME(Centril): `const` should be legal syntactically, ensure it's illegal semantically.
|
||||
const async unsafe extern "C" fn fi5() {} // OK.
|
||||
}
|
||||
|
||||
extern {
|
||||
|
|
@ -50,8 +49,6 @@ fn main() {
|
|||
unsafe fn fe2(); //~ ERROR functions in `extern` blocks cannot have qualifiers
|
||||
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 cannot have qualifiers
|
||||
//^ FIXME(Centril): `const` should be legal syntactically, ensure it's illegal semantically.
|
||||
const async unsafe extern "C" fn fe5(); //~ ERROR functions in `extern` blocks
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,19 @@ error[E0379]: trait fns cannot be declared const
|
|||
LL | const fn ft3();
|
||||
| ^^^^^ trait fns cannot be const
|
||||
|
||||
error[E0706]: trait fns cannot be declared `async`
|
||||
--> $DIR/fn-header-semantic-fail.rs:21:21
|
||||
error[E0379]: trait fns cannot be declared const
|
||||
--> $DIR/fn-header-semantic-fail.rs:21:9
|
||||
|
|
||||
LL | /* const */ async unsafe extern "C" fn ft5();
|
||||
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| `async` because of this
|
||||
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:21:9
|
||||
|
|
||||
LL | const async unsafe extern "C" fn ft5();
|
||||
| ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| `async` because of this
|
||||
|
|
||||
= note: `async` trait functions are not currently supported
|
||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||
|
|
@ -43,19 +49,25 @@ error[E0379]: trait fns cannot be declared const
|
|||
LL | const fn ft3() {}
|
||||
| ^^^^^ trait fns cannot be const
|
||||
|
||||
error[E0706]: trait fns cannot be declared `async`
|
||||
--> $DIR/fn-header-semantic-fail.rs:33:21
|
||||
error[E0379]: trait fns cannot be declared const
|
||||
--> $DIR/fn-header-semantic-fail.rs:33:9
|
||||
|
|
||||
LL | /* const */ async unsafe extern "C" fn ft5() {}
|
||||
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| `async` because of this
|
||||
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
|
||||
|
|
||||
LL | const async unsafe extern "C" fn ft5() {}
|
||||
| ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| `async` because of this
|
||||
|
|
||||
= note: `async` trait functions are not currently supported
|
||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||
|
||||
error: functions in `extern` blocks cannot have qualifiers
|
||||
--> $DIR/fn-header-semantic-fail.rs:49:18
|
||||
--> $DIR/fn-header-semantic-fail.rs:48:18
|
||||
|
|
||||
LL | extern {
|
||||
| ------ in this `extern` block
|
||||
|
|
@ -65,7 +77,7 @@ LL | async fn fe1();
|
|||
| help: remove the qualifiers: `fn`
|
||||
|
||||
error: functions in `extern` blocks cannot have qualifiers
|
||||
--> $DIR/fn-header-semantic-fail.rs:50:19
|
||||
--> $DIR/fn-header-semantic-fail.rs:49:19
|
||||
|
|
||||
LL | extern {
|
||||
| ------ in this `extern` block
|
||||
|
|
@ -76,7 +88,7 @@ LL | unsafe fn fe2();
|
|||
| help: remove the qualifiers: `fn`
|
||||
|
||||
error: functions in `extern` blocks cannot have qualifiers
|
||||
--> $DIR/fn-header-semantic-fail.rs:51:18
|
||||
--> $DIR/fn-header-semantic-fail.rs:50:18
|
||||
|
|
||||
LL | extern {
|
||||
| ------ in this `extern` block
|
||||
|
|
@ -87,7 +99,7 @@ LL | const fn fe3();
|
|||
| help: remove the qualifiers: `fn`
|
||||
|
||||
error: functions in `extern` blocks cannot have qualifiers
|
||||
--> $DIR/fn-header-semantic-fail.rs:52:23
|
||||
--> $DIR/fn-header-semantic-fail.rs:51:23
|
||||
|
|
||||
LL | extern {
|
||||
| ------ in this `extern` block
|
||||
|
|
@ -98,15 +110,15 @@ LL | extern "C" fn fe4();
|
|||
| help: remove the qualifiers: `fn`
|
||||
|
||||
error: functions in `extern` blocks cannot have qualifiers
|
||||
--> $DIR/fn-header-semantic-fail.rs:53:48
|
||||
--> $DIR/fn-header-semantic-fail.rs:52:42
|
||||
|
|
||||
LL | extern {
|
||||
| ------ in this `extern` block
|
||||
...
|
||||
LL | /* const */ async unsafe extern "C" fn fe5();
|
||||
| ---------------------------^^^
|
||||
| |
|
||||
| help: remove the qualifiers: `fn`
|
||||
LL | const async unsafe extern "C" fn fe5();
|
||||
| ---------------------------------^^^
|
||||
| |
|
||||
| help: remove the qualifiers: `fn`
|
||||
|
||||
error[E0053]: method `ft1` has an incompatible type for trait
|
||||
--> $DIR/fn-header-semantic-fail.rs:28:24
|
||||
|
|
@ -124,21 +136,21 @@ 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:54
|
||||
--> $DIR/fn-header-semantic-fail.rs:33:48
|
||||
|
|
||||
LL | /* const */ async unsafe extern "C" fn ft5();
|
||||
| - type in trait
|
||||
LL | const async unsafe extern "C" fn ft5();
|
||||
| - type in trait
|
||||
...
|
||||
LL | /* const */ async unsafe extern "C" fn ft5() {}
|
||||
| ^
|
||||
| |
|
||||
| the `Output` of this `async fn`'s found opaque type
|
||||
| expected `()`, found opaque type
|
||||
LL | const async unsafe extern "C" fn ft5() {}
|
||||
| ^
|
||||
| |
|
||||
| the `Output` of this `async fn`'s found opaque type
|
||||
| expected `()`, found opaque type
|
||||
|
|
||||
= note: expected fn pointer `unsafe extern "C" fn()`
|
||||
found fn pointer `unsafe extern "C" fn() -> impl std::future::Future`
|
||||
|
||||
error: aborting due to 13 previous errors
|
||||
error: aborting due to 15 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0053, E0379, E0706.
|
||||
For more information about an error, try `rustc --explain E0053`.
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@ fn syntax() {
|
|||
unsafe fn f();
|
||||
const fn f();
|
||||
extern "C" fn f();
|
||||
/* const */ async unsafe extern "C" fn f();
|
||||
//^ FIXME(Centril): `const` should be legal syntactically.
|
||||
const async unsafe extern "C" fn f();
|
||||
}
|
||||
|
||||
impl X for Y {
|
||||
|
|
@ -31,8 +30,7 @@ fn syntax() {
|
|||
unsafe fn f();
|
||||
const fn f();
|
||||
extern "C" fn f();
|
||||
/* const */ async unsafe extern "C" fn f();
|
||||
//^ FIXME(Centril): `const` should be legal syntactically.
|
||||
const async unsafe extern "C" fn f();
|
||||
}
|
||||
|
||||
impl Y {
|
||||
|
|
@ -40,8 +38,7 @@ fn syntax() {
|
|||
unsafe fn f();
|
||||
const fn f();
|
||||
extern "C" fn f();
|
||||
/* const */ async unsafe extern "C" fn f();
|
||||
//^ FIXME(Centril): `const` should be legal syntactically.
|
||||
const async unsafe extern "C" fn f();
|
||||
}
|
||||
|
||||
extern {
|
||||
|
|
@ -49,7 +46,6 @@ fn syntax() {
|
|||
unsafe fn f();
|
||||
const fn f();
|
||||
extern "C" fn f();
|
||||
/* const */ async unsafe extern "C" fn f();
|
||||
//^ FIXME(Centril): `const` should be legal syntactically.
|
||||
const async unsafe extern "C" fn f();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue