Skip to content

Commit a593a6c

Browse files
committed
Add an attribute-related parenthesization edge case
1 parent c46cb00 commit a593a6c

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
@@ -94,6 +94,12 @@ static EXPRS: &[&str] = &[
9494
"#[attr] (1 as T)",
9595
"#[attr] (x = 1)",
9696
"#[attr] (x += 1)",
97+
// If the attribute were not present on the binary operation, it would be
98+
// legal to render this without not just the inner parentheses, but also the
99+
// outer ones. `return x + .. .field` (Yes, really.) Currently the
100+
// pretty-printer does not take advantage of this edge case.
101+
"(return #[attr] (x + ..)).field",
102+
"(return x + ..).field",
97103
// Grammar restriction: break value starting with a labeled loop is not
98104
// allowed, except if the break is also labeled.
99105
"break 'outer 'inner: loop {} + 2",

0 commit comments

Comments
 (0)