Skip to content

Commit 669be1a

Browse files
committed
On incorrect cfg literal/identifier, point at the right span
1 parent c1d2d83 commit 669be1a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/libsyntax/parse/attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl<'a> Parser<'a> {
286286

287287
let found = self.this_token_to_string();
288288
let msg = format!("expected unsuffixed literal or identifier, found {}", found);
289-
Err(self.diagnostic().struct_span_err(lo, &msg))
289+
Err(self.diagnostic().struct_span_err(self.span, &msg))
290290
}
291291

292292
/// matches meta_seq = ( COMMASEP(meta_item_inner) )

src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ LL | #[cfg(a = b"hi")] //~ ERROR literal in `cfg` predicate value must be a str
5353
| ^^^^^ help: consider removing the prefix: `"hi"`
5454

5555
error: expected unsuffixed literal or identifier, found concat!("nonexistent")
56-
--> $DIR/cfg-attr-syntax-validation.rs:30:15
56+
--> $DIR/cfg-attr-syntax-validation.rs:30:25
5757
|
5858
LL | #[cfg(feature = $expr)]
59-
| ^^^^^^^
59+
| ^^^^^
6060
...
6161
LL | generate_s10!(concat!("nonexistent"));
6262
| -------------------------------------- in this macro invocation

0 commit comments

Comments
 (0)