]> git.lizzy.rs Git - rust.git/commitdiff
On incorrect cfg literal/identifier, point at the right span
authorEsteban Küber <esteban@kuber.com.ar>
Wed, 6 Mar 2019 03:05:03 +0000 (19:05 -0800)
committerEsteban Küber <esteban@kuber.com.ar>
Wed, 6 Mar 2019 03:05:03 +0000 (19:05 -0800)
src/libsyntax/parse/attr.rs
src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr

index e7937f57002f3f8cfd4efd61f663c0ce0f805f5f..6c02a7407e04dee093bd98417e02d8d1562225d5 100644 (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) )
index bcf13ead2f4f7eb7783d11394bb30e4396aadb8a..0770d1038e11d5070f4a56aa0ead159a1a780041 100644 (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