Skip to content

Commit

Permalink
On incorrect cfg literal/identifier, point at the right span
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Mar 6, 2019
1 parent c1d2d83 commit 669be1a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/libsyntax/parse/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ impl<'a> Parser<'a> {

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) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 669be1a

Please sign in to comment.