On incorrect cfg literal/identifier, point at the right span

This commit is contained in:
Esteban Küber 2019-03-05 19:05:03 -08:00
parent c1d2d83ca3
commit 669be1a0a6
2 changed files with 3 additions and 3 deletions

View File

@ -286,7 +286,7 @@ fn parse_meta_item_inner(&mut self) -> PResult<'a, ast::NestedMetaItem> {
let found = self.this_token_to_string();
let msg = format!("expected unsuffixed literal or identifier, found {}", found);
Err(self.diagnostic().struct_span_err(lo, &msg))
Err(self.diagnostic().struct_span_err(self.span, &msg))
}
/// matches meta_seq = ( COMMASEP(meta_item_inner) )

View File

@ -53,10 +53,10 @@ LL | #[cfg(a = b"hi")] //~ ERROR literal in `cfg` predicate value must be a str
| ^^^^^ help: consider removing the prefix: `"hi"`
error: expected unsuffixed literal or identifier, found concat!("nonexistent")
--> $DIR/cfg-attr-syntax-validation.rs:30:15
--> $DIR/cfg-attr-syntax-validation.rs:30:25
|
LL | #[cfg(feature = $expr)]
| ^^^^^^^
| ^^^^^
...
LL | generate_s10!(concat!("nonexistent"));
| -------------------------------------- in this macro invocation