Skip to content

Commit

Permalink
Fix span of invalid metavariable repetition
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-schievink committed Aug 14, 2015
1 parent c1e865c commit 59f8e32
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/libsyntax/ext/tt/transcribe.rs
Expand Up @@ -305,7 +305,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
}
MatchedSeq(..) => {
panic!(r.sp_diag.span_fatal(
r.cur_span, /* blame the macro writer */
sp, /* blame the macro writer */
&format!("variable '{}' is still repeating at this depth",
ident)));
}
Expand Down
19 changes: 19 additions & 0 deletions src/test/parse-fail/macro-repeat.rs
@@ -0,0 +1,19 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

macro_rules! mac {
( $($v:tt)* ) => (
$v //~ ERROR still repeating at this depth
)
}

fn main() {
mac!(0);
}

0 comments on commit 59f8e32

Please sign in to comment.