Point at correct span when missing comma in println
This commit is contained in:
parent
4862eee8b7
commit
cce4ea5149
@ -147,7 +147,7 @@ fn parse_args(ecx: &mut ExtCtxt,
|
||||
let mut named = false;
|
||||
while p.token != token::Eof {
|
||||
if !p.eat(&token::Comma) {
|
||||
ecx.span_err(sp, "expected token: `,`");
|
||||
ecx.span_err(p.span, "expected token: `,`");
|
||||
return None;
|
||||
}
|
||||
if p.token == token::Eof {
|
||||
|
@ -7,20 +7,16 @@ LL | format!(); //~ ERROR requires at least a format string argument
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
error: expected token: `,`
|
||||
--> $DIR/bad-format-args.rs:13:5
|
||||
--> $DIR/bad-format-args.rs:13:16
|
||||
|
|
||||
LL | format!("" 1); //~ ERROR expected token: `,`
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
| ^
|
||||
|
||||
error: expected token: `,`
|
||||
--> $DIR/bad-format-args.rs:14:5
|
||||
--> $DIR/bad-format-args.rs:14:19
|
||||
|
|
||||
LL | format!("", 1 1); //~ ERROR expected token: `,`
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
| ^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -8,7 +8,13 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
macro_rules! foo {
|
||||
($a:ident, $b:ident) => ()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("{}" a);
|
||||
//~^ ERROR no rules expected the token `a`
|
||||
//~^ ERROR expected token: `,`
|
||||
foo!(a b);
|
||||
//~^ ERROR no rules expected the token `b`
|
||||
}
|
||||
|
@ -1,10 +1,16 @@
|
||||
error: no rules expected the token `a`
|
||||
--> $DIR/missing-comma.rs:12:19
|
||||
error: expected token: `,`
|
||||
--> $DIR/missing-comma.rs:16:19
|
||||
|
|
||||
LL | println!("{}" a);
|
||||
| -^
|
||||
| |
|
||||
| help: missing comma here
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
error: no rules expected the token `b`
|
||||
--> $DIR/missing-comma.rs:18:12
|
||||
|
|
||||
LL | foo!(a b);
|
||||
| -^
|
||||
| |
|
||||
| help: missing comma here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user