-
Notifications
You must be signed in to change notification settings - Fork 13.6k
parse: unify function front matter parsing #69023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e839b2e
Constness -> enum Const { Yes(Span), No }
Centril c30f068
IsAsync -> enum Async { Yes { span: Span, .. }, No }
Centril 36a17e4
parser_fn_front_matter: allow `const .. extern`
Centril a833be2
parser: fuse free `fn` parsing together.
Centril b05e9d2
parser: solidify `fn` parsing with `parse_fn`.
Centril 0425379
parser: inline `parse_assoc_fn` and friends.
Centril cdbbc25
parser: move `ban_async_in_2015` to `fn` parsing & improve it.
Centril 05e5530
parser: address review comments
Centril 79d139a
parser: simplify ParamCfg -> ReqName
Centril 3341c94
ast_validation: tweak diagnostic output
Centril 27f6090
rustc_bulltin_macros: tweak span_labels
Centril 4ca3bbf
parser: add test for 'extern crate async'
Centril 9828559
parser: is_fn_front_matter -> check_fn_front_matter
Centril File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
parser: fuse free
fn
parsing together.
- Loading branch information
commit a833be21626890de406e12f2561d2ffbda4aadb4
There are no files selected for viewing
This file contains hidden or 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 hidden or bidirectional Unicode text that may be
8000
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -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 | ||
|
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -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 | ||
|
This file contains hidden or 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 hidden or 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
14 changes: 6 additions & 8 deletions
14
src/test/ui/consts/const-extern-fn/feature-gate-const_extern_fn.rs
This file contains hidden or 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 |
---|---|---|
@@ -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() {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.