Uh oh!
There was an error while loading. Please reload this page.
Allow lifetimes in macros - #41927
Conversation
Started rebasing @sgrif's PR rust-lang#33135 off of current master. (Well, actually merging it into a new branch based off current master.) The following files still need to be fixed or at least reviewed: - `src/libsyntax/ext/tt/macro_parser.rs`: calls `Parser::parse_lifetime`, which doesn't exist anymore - `src/libsyntax/parse/parser.rs`: @sgrif added an error message to `Parser::parse_lifetime`. Code has since been refactored, so I just took it out for now. - `src/libsyntax/ext/tt/transcribe.rs`: This code has been refactored bigtime. Not sure whether @sgrif's changes here are still necessary. Took it out for this commit.
made `parser::Parser::expect_lifetime` public, so it can be called from `macro_parser::parse_nt`
rust-highfive
commented
May 11, 2017
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (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. Due to 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 the contribution instructions for more information. |
shepmaster
commented
May 12, 2017
kennytm
commented
May 12, 2017
All three tests failed, "expected one of BTW, could you add some tests to show that the patch handles labels? #![allow(unreachable_code)]macro_rules! x {($a:lifetime) => {
$a:loop{break $a;
panic!("failed");}}}macro_rules! br {($a:lifetime) => {break $a;}}macro_rules! br2 {($b:lifetime) => {'b:loop{break $b;// this $b should refer to the outer loop.}}}fnmain(){x!('a);'c:loop{br!('c);panic!("failed");}'b:loop{br2!('b);panic!("failed");}} |
mikeyhew
commented
May 12, 2017
Thanks @kennytm, and sure, I'll add those tests. What is the quickest way to run tests for libsyntax? Anything with |
petrochenkov
commented
May 13, 2017
Do you include LLVM build and similar in "forever"? It only needs to be done once. |
bors
commented
May 17, 2017
☔ The latest upstream changes (presumably #42049) made this pull request unmergeable. Please resolve the merge conflicts. |
mikeyhew
commented
May 20, 2017
I'm too busy with school right now, and I still don't really understand the code in this PR so I'm going to give up. Someone else will have to take over for this to get implemented. |
This is a resurrection of PR #33135.
@sgrif can you take a look at the following diffs from #33135, and see if those changes are still necessary?
Still to do: