Skip to content

Commit cf3981d

Browse files
committed
Add an attribute-related parenthesization edge case
1 parent 29b5058 commit cf3981d

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

0 commit comments

Comments
 (0)