Skip to content

Better error message on invalid fragment specifiers in macros#21158

Merged
bors merged 1 commit into
rust-lang:masterfrom
alkor:issue-21131
Jan 28, 2015
Merged

Better error message on invalid fragment specifiers in macros#21158
bors merged 1 commit into
rust-lang:masterfrom
alkor:issue-21131

Conversation

@alkor

@alkor alkor commented Jan 14, 2015

Copy link
Copy Markdown
Contributor

Closes #21131
Issue #21131 is already fixed in PR #21429.

I just edited error messages to match terminology from the macros guide ("fragment specifiers")

@rust-highfive

Copy link
Copy Markdown
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nick29581 (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see CONTRIBUTING.md for more information.

Comment thread src/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.

the {} should be enclosed in ```s

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.

bleugh, I was trying to format backticks/graves there

@nrc

nrc commented Jan 14, 2015

Copy link
Copy Markdown
Member

r=me with the nit about backticks fixed, if you want to add a helpful message, that would be great, but its not necessary to fix this bug.

Thanks for the PR!

Comment thread src/libsyntax/ext/tt/macro_rules.rs Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure about silently accepting invalid specifiers here.
Alternative is calling span_help() and span_fatal(), but I didn't want to duplicate error messages from parse_nt.

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.

@cmr - do you think this is OK? It seems OK to me, but also a little bit bad.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems reasonable to me, should add in a comment in parse_nt that this bit of code depends on it rejecting invalid fragment specifiers.

@alexcrichton

Copy link
Copy Markdown
Member

re-r? @nick29581

Also, print help on valid fragment specifiers.
@alkor alkor changed the title Print error instead of ICE on illegal macro_rules Better error message on invalid fragment specifiers in macros Jan 23, 2015
@alkor

alkor commented Jan 23, 2015

Copy link
Copy Markdown
Contributor Author

@nick29581 Issue #21131 is already fixed in master. So after rebase this PR only modifies error messages to match terminology from the macros guide.

@nrc

nrc commented Jan 27, 2015

Copy link
Copy Markdown
Member

@bors r+ 8a22454

bors added a commit that referenced this pull request Jan 28, 2015
@bors

bors commented Jan 28, 2015

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 8a22454 with merge 06410ef...

@bors

bors commented Jan 28, 2015

Copy link
Copy Markdown
Collaborator

@bors bors merged commit 8a22454 into rust-lang:master Jan 28, 2015
@alkor alkor deleted the issue-21131 branch January 28, 2015 17:04
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.

ICE on illegal macro_rules!

6 participants