Skip to content

reject macros with empty repetitions - #36721

Merged
bors merged 1 commit into
rust-lang:masterfrom
TimNN:infinite-emptiness
Sep 27, 2016
Merged

reject macros with empty repetitions#36721
bors merged 1 commit into
rust-lang:masterfrom
TimNN:infinite-emptiness

Conversation

@TimNN

Copy link
Copy Markdown
Contributor

Fixes#5067 by checking the lhs of macro_rules! for repetitions which could match an empty token tree.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @nrc

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

Comment threadsrc/libsyntax/ext/tt/macro_rules.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could use lhses.iter().all() instead of the for loop.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

The for loop was mainly used to use the same style as the loop of the rhses directly above.

Also .iter().all() would abort early, I think, which means that not all lhses would be checked, ie. not all errors we could report would be reported.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok, good point on not reporting all errors. Could you add a comment to explain that please?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done.

@nrc

nrc commented Sep 25, 2016

Copy link
Copy Markdown
Member

r=me with the for loop replaced

@nrc

nrc commented Sep 25, 2016

Copy link
Copy Markdown
Member

@bors: r+

@bors

bors commented Sep 25, 2016

Copy link
Copy Markdown
Collaborator

📌 Commit d06a9ca has been approved by nrc

@bors

bors commented Sep 25, 2016

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #36616) made this pull request unmergeable. Please resolve the merge conflicts.

@TimNN

Copy link
Copy Markdown
ContributorAuthor

Rebased.

@nrc

nrc commented Sep 26, 2016

Copy link
Copy Markdown
Member

@bors: r+

@bors

bors commented Sep 26, 2016

Copy link
Copy Markdown
Collaborator

📌 Commit 51ea050 has been approved by nrc

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Sep 26, 2016
reject macros with empty repetitions
Fixesrust-lang#5067 by checking the lhs of `macro_rules!` for repetitions which could match an empty token tree.
@sophiajtsophiajt mentioned this pull request Sep 26, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Sep 27, 2016
reject macros with empty repetitions
Fixesrust-lang#5067 by checking the lhs of `macro_rules!` for repetitions which could match an empty token tree.
@sophiajtsophiajt mentioned this pull request Sep 27, 2016
bors added a commit that referenced this pull request Sep 27, 2016
@bors
bors merged commit 51ea050 into rust-lang:masterSep 27, 2016
@TimNN
TimNN deleted the infinite-emptiness branch September 28, 2016 09:29
Sign up for freeto 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

@TimNN@rust-highfive@nrc@bors