diff options
Diffstat (limited to 'tests/ui/paren-span.rs')
-rw-r--r-- | tests/ui/paren-span.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/paren-span.rs b/tests/ui/paren-span.rs new file mode 100644 index 000000000..c8cb63d51 --- /dev/null +++ b/tests/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 +} |