forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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 rust-lang#62241 - Centril:fix-async-unsafe-order, r=p…
…etrochenkov Always parse 'async unsafe fn' + properly ban in 2015 Parse `async unsafe fn` not `unsafe async fn` in implementations. We also take the opportunity to properly ban `async fn` in Rust 2015 when they are inside implementations. Closes rust-lang#62232. cc rust-lang#61319, rust-lang#62121, and rust-lang#62149. r? @petrochenkov
- Loading branch information
Showing
7 changed files
with
77 additions
and
28 deletions.
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
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
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
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
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
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,11 @@ | ||
// edition:2018 | ||
|
||
struct S; | ||
|
||
impl S { | ||
#[cfg(FALSE)] | ||
unsafe async fn g() {} //~ ERROR expected one of `extern` or `fn`, found `async` | ||
} | ||
|
||
#[cfg(FALSE)] | ||
unsafe async fn f() {} //~ ERROR expected one of `extern`, `fn`, or `{`, found `async` |
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,14 @@ | ||
error: expected one of `extern` or `fn`, found `async` | ||
--> $DIR/no-unsafe-async.rs:7:12 | ||
| | ||
LL | unsafe async fn g() {} | ||
| ^^^^^ expected one of `extern` or `fn` here | ||
|
||
error: expected one of `extern`, `fn`, or `{`, found `async` | ||
--> $DIR/no-unsafe-async.rs:11:8 | ||
| | ||
LL | unsafe async fn f() {} | ||
| ^^^^^ expected one of `extern`, `fn`, or `{` here | ||
|
||
error: aborting due to 2 previous errors | ||
|