-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #68073 - Centril:fix-68062, r=estebank
expect `fn` after `const unsafe` / `const extern` Fixes #68062 r? @estebank @petrochenkov cc @Aaron1011
- Loading branch information
Showing
5 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier-2.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
fn main() {} | ||
|
||
#[cfg(FALSE)] | ||
fn container() { | ||
const unsafe WhereIsFerris Now() {} | ||
//~^ ERROR expected one of `extern` or `fn` | ||
} |
8 changes: 8 additions & 0 deletions
8
...st/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier-2.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
8 changes: 8 additions & 0 deletions
8
src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
18 changes: 18 additions & 0 deletions
18
...test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |