diff options
| author | John Clements <clements@racket-lang.org> | 2014-07-07 17:43:09 -0700 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2014-07-08 16:27:38 -0700 |
| commit | 69c27546ee37ac2d0384748a21c7dad00642a223 (patch) | |
| tree | 5daec5dca6810b7ce05f830f4802f2c7726b1d19 /src/libsyntax | |
| parent | af794a5aae761306ffc894ebd2bedd44f2a9703c (diff) | |
| download | rust-69c27546ee37ac2d0384748a21c7dad00642a223.tar.gz rust-69c27546ee37ac2d0384748a21c7dad00642a223.zip | |
macro literals should be compared by name only
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index f51002f734c..d5a9f34dcb9 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1325,6 +1325,14 @@ mod test { "macro_rules! m((a)=>(13)) fn main(){m!(a);}".to_string()); } + // should be able to use a bound identifier as a literal in a macro definition: + #[test] fn self_macro_parsing(){ + expand_crate_str( + "macro_rules! foo ((zz) => (287u;)) + fn f(zz : int) {foo!(zz);}".to_string() + ); + } + // renaming tests expand a crate and then check that the bindings match // the right varrefs. The specification of the test case includes the // text of the crate, and also an array of arrays. Each element in the diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 913e0427bda..b30ede70f0e 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -354,8 +354,7 @@ pub fn parse(sess: &ParseSess, MatchNonterminal(_,_,_) => { bb_eis.push(ei) } MatchTok(ref t) => { let mut ei_t = ei.clone(); - //if (token_name_eq(t,&tok)) { - if token::mtwt_token_eq(t,&tok) { + if token_name_eq(t,&tok) { ei_t.idx += 1; next_eis.push(ei_t); } |
