Skip to content

Commit

Permalink
macro literals should be compared by name only
Browse files Browse the repository at this point in the history
  • Loading branch information
jbclements committed Jul 8, 2014
1 parent af794a5 commit 69c2754
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/libsyntax/ext/expand.rs
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/libsyntax/ext/tt/macro_parser.rs
Expand Up @@ -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);
}
Expand Down

0 comments on commit 69c2754

Please sign in to comment.