On incorrect cfg literal/identifier, point at the right span
This commit is contained in:
parent
c1d2d83ca3
commit
669be1a0a6
@ -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) )
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user