summaryrefslogtreecommitdiffstats
path: root/src/test/ui/paren-span.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/paren-span.rs')
-rw-r--r--src/test/ui/paren-span.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/paren-span.rs b/src/test/ui/paren-span.rs
new file mode 100644
index 000000000..c8cb63d51
--- /dev/null
+++ b/src/test/ui/paren-span.rs
@@ -0,0 +1,21 @@
+// Be smart about span of parenthesized expression in macro.
+
+macro_rules! paren {
+ ($e:expr) => (($e))
+ // ^^^^ do not highlight here
+}
+
+mod m {
+ pub struct S {
+ x: i32
+ }
+ pub fn make() -> S {
+ S { x: 0 }
+ }
+}
+
+fn main() {
+ let s = m::make();
+ paren!(s.x); //~ ERROR field `x` of struct `S` is private
+ // ^^^ highlight here
+}