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

syntax: Enable parsing of const globals #17729

Merged
merged 2 commits into from
Oct 3, 2014

Conversation

alexcrichton
Copy link
Member

This rewrites them to the current ItemStatic production of the compiler, but I
want to get this into a snapshot. It will be illegal to use a static in a
pattern of a match statement, so all those current uses will need to be
rewritten to const once it's implemented. This requires that the stage0
snapshot is able to parse const.

cc #17718

// except according to those terms.

const mut FOO: uint = 3; //~ ERROR: expected identifier, found keyword `mut`
//~^ ERROR: expected `:`, found `FOO`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flow-on error seems unfortunate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(It seems sensible that const mut is actually detected and handled with a special message: "constants cannot be mutable, maybe you mean a static?")

@huonw
Copy link
Member

huonw commented Oct 3, 2014

r=me with handling of mut (or just a FIXME & opening an issue to not get in the way of progress/snapshotting).

This rewrites them to the current `ItemStatic` production of the compiler, but I
want to get this into a snapshot. It will be illegal to use a `static` in a
pattern of a `match` statement, so all those current uses will need to be
rewritten to `const` once it's implemented. This requires that the stage0
snapshot is able to parse `const`.

cc rust-lang#17718
@alexcrichton
Copy link
Member Author

Updated with a better error message

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Oct 3, 2014
@bors bors merged commit da7dcee into rust-lang:master Oct 3, 2014
@alexcrichton alexcrichton deleted the issue-17718-start branch October 11, 2014 21:39
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