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

parse: allow `type Foo: Ord` syntactically #69361

merged 2 commits into from Feb 23, 2020


Copy link

Centril commented Feb 21, 2020

This addresses:

(Work still remains to fuse this with free type aliases, but this can be done later.)

in #69194.

r? @petrochenkov

@Centril Centril force-pushed the Centril:free-ty-alias branch from 35e8027 to 9f3dfd2 Feb 21, 2020

This comment has been minimized.

Copy link

petrochenkov commented Feb 21, 2020

@bors r+


This comment has been minimized.

Copy link

bors commented Feb 21, 2020

📌 Commit 9f3dfd2 has been approved by petrochenkov

bors added a commit that referenced this pull request Feb 23, 2020
Rollup of 5 pull requests

Successful merges:

 - #69336 (Do not ping the infrastructure team on toolstate changes)
 - #69351 (Improve external MinGW detection)
 - #69361 (parse: allow `type Foo: Ord` syntactically)
 - #69375 (Rename CodeMap to SourceMap follow up)
 - #69376 (parser: Cleanup `Parser::bump_with` and its uses)

Failed merges:

r? @ghost
@bors bors merged commit ae50725 into rust-lang:master Feb 23, 2020
4 checks passed
4 checks passed
pr Build #20200221.42 succeeded
pr (Linux mingw-check) Linux mingw-check succeeded
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
@Centril Centril deleted the Centril:free-ty-alias branch Feb 23, 2020
bors added a commit that referenced this pull request Feb 24, 2020
parse: unify item parsing & filter illegal item kinds

This PR fully unifies item parsing into a single `fn parse_item_common` method which produces `Option<Item>`. The `Item` is then mapped into `ForeignItem` and `AssocItem` as necessary by transforming the `*Kind` and converting contextually bad variants into `None`, thereby filtering them away.

The PR does not yet unmerge the definition of `ForeignItemKind` from `AssocItemKind`. I've left that as future work as it didn't feel like this parser-focused PR would be the best one to deal with it. Changes to the AST data structures are instead kept to a reasonable minimum.

Based on #69361.

Fixes #48137.
RELNOTES: Now, `item` macro fragments can be interpolated into `impl`, `trait`, and `extern` contexts. See `src/test/ui/parser/` for the relevant test.

r? @petrochenkov
cc @estebank
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.