mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
expect fn
after const unsafe
/ const extern
This commit is contained in:
parent
59eb49d0da
commit
915db7ae64
@ -140,7 +140,7 @@ impl<'a> Parser<'a> {
|
||||
self.sess.gated_spans.gate(sym::const_extern_fn, lo.to(self.token.span));
|
||||
}
|
||||
let ext = self.parse_extern()?;
|
||||
self.bump(); // `fn`
|
||||
self.expect_keyword(kw::Fn)?;
|
||||
|
||||
let header = FnHeader {
|
||||
unsafety,
|
||||
|
@ -0,0 +1,7 @@
|
||||
fn main() {}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
fn container() {
|
||||
const unsafe WhereIsFerris Now() {}
|
||||
//~^ ERROR expected one of `extern` or `fn`
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
error: expected one of `extern` or `fn`, found `WhereIsFerris`
|
||||
--> $DIR/issue-68062-const-extern-fns-dont-need-fn-specifier-2.rs:5:18
|
||||
|
|
||||
LL | const unsafe WhereIsFerris Now() {}
|
||||
| ^^^^^^^^^^^^^ expected one of `extern` or `fn`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,8 @@
|
||||
fn main() {}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
fn container() {
|
||||
const extern "Rust" PUT_ANYTHING_YOU_WANT_HERE bug() -> usize { 1 }
|
||||
//~^ ERROR expected `fn`
|
||||
//~| ERROR `const extern fn` definitions are unstable
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
error: expected `fn`, found `PUT_ANYTHING_YOU_WANT_HERE`
|
||||
--> $DIR/issue-68062-const-extern-fns-dont-need-fn-specifier.rs:5:25
|
||||
|
|
||||
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: for more information, see https://github.com/rust-lang/rust/issues/64926
|
||||
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
Loading…
Reference in New Issue
Block a user