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 macros named "default" correctly. #42330

Merged
merged 2 commits into from
May 31, 2017

Conversation

qnighy
Copy link
Contributor

@qnighy qnighy commented May 31, 2017

Fixes #42292.

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

t.is_keyword(keywords::Extern) ||
t.is_keyword(keywords::Type) ||
t.is_keyword(keywords::Pub))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you do something like this instead, to keep default in the expected token set

fn eat_defaultness(&self) -> bool {
    let is_defaultness = self.is_defaultness();
    if is_defaultness {
        self.bump();
    } else {
        self.expected_tokens.push(/*default keyword token*/);
    }
    is_defaultness
}

All this logic can probably be just inlined into parse_defaultness as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@petrochenkov
Copy link
Contributor

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented May 31, 2017

📌 Commit b670930 has been approved by petrochenkov

@Mark-Simulacrum
Copy link
Member

@bors rollup

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request May 31, 2017
…chenkov

Parse macros named "default" correctly.

Fixes rust-lang#42292.
bors added a commit that referenced this pull request May 31, 2017
Rollup of 7 pull requests

- Successful merges: #42126, #42196, #42252, #42277, #42315, #42329, #42330
- Failed merges:
@bors bors merged commit b670930 into rust-lang:master May 31, 2017
@qnighy qnighy deleted the macro-named-default branch June 7, 2017 03:15
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.

6 participants