Skip to content

Commit 6008f48

Browse files
committed
Add AST pretty-printer tests involving attr on binary operation
This test currently fails (as expected). --- stderr ------------------------------- Pretty-printer lost necessary parentheses BEFORE: #[attr] (1 + 1) AFTER: #[attr] 1 + 1 Pretty-printer lost necessary parentheses BEFORE: #[attr] (1 as T) AFTER: #[attr] 1 as T Pretty-printer lost necessary parentheses BEFORE: #[attr] (x = 1) AFTER: #[attr] x = 1 Pretty-printer lost necessary parentheses BEFORE: #[attr] (x += 1) AFTER: #[attr] x += 1 ------------------------------------------
1 parent 1ed0cbf commit 6008f48

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
@@ -92,6 +92,12 @@ static EXPRS: &[&str] = &[
9292
"#[attr] loop {}.field",
9393
"(#[attr] loop {}).field",
9494
"loop { #![attr] }.field",
95+
// Attributes on a Binary, Cast, Assign, and AssignOp expression require
96+
// parentheses.
97+
"#[attr] (1 + 1)",
98+
"#[attr] (1 as T)",
99+
"#[attr] (x = 1)",
100+
"#[attr] (x += 1)",
95101
// Grammar restriction: break value starting with a labeled loop is not
96102
// allowed, except if the break is also labeled.
97103
"break 'outer 'inner: loop {} + 2",

0 commit comments

Comments
 (0)