Skip to content

Commit 535e11f

Browse files
committed
Add an attribute-related parenthesization edge case
1 parent 12a855d commit 535e11f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/ui-fulldeps/pprust-parenthesis-insertion.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ static EXPRS: &[&str] = &[
101101
"#[attr] (x += 1)",
102102
"#[attr] (lo..hi)",
103103
"#[attr] (..hi)",
104+
// If the attribute were not present on the binary operation, it would be
105+
// legal to render this without not just the inner parentheses, but also the
106+
// outer ones. `return x + .. .field` (Yes, really.) Currently the
107+
// pretty-printer does not take advantage of this edge case.
108+
"(return #[attr] (x + ..)).field",
109+
"(return x + ..).field",
104110
// Grammar restriction: break value starting with a labeled loop is not
105111
// allowed, except if the break is also labeled.
106112
"break 'outer 'inner: loop {} + 2",

0 commit comments

Comments
 (0)