Auto merge of #27841 - jonas-schievink:still-repeating-span, r=alexcrichton

Current behaviour demo: http://is.gd/l3FEgo
(The span is printed at the start of the source code)

This patch moves the span to the use of `$i` in the macro rhs (as the code comment already claims)
This commit is contained in:
bors 2015-08-15 06:16:41 +00:00
commit e859498d1c
2 changed files with 20 additions and 1 deletions

View File

@ -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)));
}

View File

@ -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);
}