Skip to content
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

Rustup #6033

Merged
merged 4 commits into from
Sep 13, 2020
Merged

Rustup #6033

merged 4 commits into from
Sep 13, 2020

Conversation

flip1995
Copy link
Member

r? @ghost

changelog: none

flip1995 and others added 4 commits September 10, 2020 17:47
This commit contains miscellaneous changes that don't fit into any of
the other commits in this PR
Attach tokens to all AST types used in `Nonterminal`

We perform token capturing when we have outer attributes (for nonterminals that support attributes - e.g. `Stmt`), or when we parse a `Nonterminal` for a `macro_rules!` argument. The full list of `Nonterminals` affected by this PR is:

* `NtBlock`
* `NtStmt`
* `NtTy`
* `NtMeta`
* `NtPath`
* `NtVis`
* `NtLiteral`

Of these nonterminals, only `NtStmt` and `NtLiteral` (which is actually just an `Expr`), support outer attributes - the rest only ever have token capturing perform when they match a `macro_rules!` argument.

This makes progress towards solving rust-lang/rust#43081 - we now collect tokens for everything that might need them. However, we still need to handle `#[cfg]`, inner attributes, and misc pretty-printing issues (e.g. #75734)

I've separated the changes into (mostly) independent commits, which could be split into individual PRs for each `Nonterminal` variant. The purpose of having them all in one PR is to do a single Crater run for all of them.

Most of the changes in this PR are trivial (adding `tokens: None` everywhere we construct the various AST structs). The significant changes are:

* `ast::Visibility` is changed from `type Visibility = Spanned<VisibilityKind>` to a `struct Visibility { kind, span, tokens }`.
* `maybe_collect_tokens` is made generic, and used for both `ast::Expr` and `ast::Stmt`.
* Some of the statement-parsing functions are refactored so that we can capture the trailing semicolon.
* `Nonterminal` and `Expr` both grew by 8 bytes, as some of the structs which are stored inline (rather than behind a `P`) now have an `Option<TokenStream>` field. Hopefully the performance impact of doing this is negligible.
@flip1995
Copy link
Member Author

@bors r+ p=1

@bors
Copy link
Contributor

bors commented Sep 12, 2020

📌 Commit 4df2069 has been approved by flip1995

@bors
Copy link
Contributor

bors commented Sep 12, 2020

⌛ Testing commit 4df2069 with merge 38b5a8e...

bors added a commit that referenced this pull request Sep 12, 2020
Rustup

r? `@ghost`

changelog: none
@bors
Copy link
Contributor

bors commented Sep 12, 2020

💔 Test failed - checks-action_test

@matthiaskrgr
Copy link
Member

@bors retry

@bors
Copy link
Contributor

bors commented Sep 12, 2020

⌛ Testing commit 4df2069 with merge 07f8ac2...

bors added a commit that referenced this pull request Sep 12, 2020
Rustup

r? `@ghost`

changelog: none
@bors
Copy link
Contributor

bors commented Sep 12, 2020

💔 Test failed - checks-action_test

@ghost
Copy link

ghost commented Sep 13, 2020

Is it failing due to rust-lang/rustup#2485 ?

@ghost
Copy link

ghost commented Sep 13, 2020

Maybe the fix has landed.
@bors retry

@bors
Copy link
Contributor

bors commented Sep 13, 2020

⌛ Testing commit 4df2069 with merge f2ecf39...

@bors
Copy link
Contributor

bors commented Sep 13, 2020

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing f2ecf39 to master...

@bors bors merged commit f2ecf39 into rust-lang:master Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants