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

Allow an underscore as the identifier in const items #1847

Merged
merged 2 commits into from
Sep 15, 2019

Conversation

ecstatic-morse
Copy link
Contributor

RFC 2526 was recently stabilized, meaning const _: i32 = 5; is now a valid item.

@ecstatic-morse
Copy link
Contributor Author

ecstatic-morse commented Sep 14, 2019

@matklad I think more work needs to be done in the AST, since ConstDef is declared as a NameOwner in grammar.ron but now only sometimes has a name. Perhaps you could point me in the right direction?

@matklad
Copy link
Member

matklad commented Sep 15, 2019

We already assume that everything in AST is optional, so this should mostly work as is. However it would be useful to change Name in ConstData in code_model to an Option<Name> in the follow up PR!

bors r+

Thanks!

bors bot added a commit that referenced this pull request Sep 15, 2019
1847: Allow an underscore as the identifier in `const` items r=matklad a=ecstatic-morse

[RFC 2526](rust-lang/rust#54912) was recently stabilized, meaning `const _: i32 = 5;` is now a valid item.

Co-authored-by: Dylan MacKenzie <ecstaticmorse@gmail.com>
@bors
Copy link
Contributor

bors bot commented Sep 15, 2019

Build succeeded

@bors bors bot merged commit c413f44 into rust-lang:master Sep 15, 2019
bors bot added a commit that referenced this pull request Sep 16, 2019
1852: Gracefully handle `const _` items in `ConstData` r=ecstatic-morse a=ecstatic-morse

A follow-up to #1847.

This makes the `name` field of `ConstData` optional.

Co-authored-by: Dylan MacKenzie <ecstaticmorse@gmail.com>
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.

2 participants