about summary refs log tree commit diff
path: root/tests/ui/macros/stringify.rs
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2023-12-17 20:00:27 -0800
committerDavid Tolnay <dtolnay@gmail.com>2023-12-18 22:40:48 -0800
commit17239d9b641afa04d7ddc51e48a422ea1da1d2b8 (patch)
treeda3ead4159bede8cf51b1885e1ff2b8185c075f6 /tests/ui/macros/stringify.rs
parent527e2eac17c5d3709e4e30e8b72ae33a6e8990b1 (diff)
downloadrust-17239d9b641afa04d7ddc51e48a422ea1da1d2b8.tar.gz
rust-17239d9b641afa04d7ddc51e48a422ea1da1d2b8.zip
Fix parenthesization of subexprs containing statement boundary
Diffstat (limited to 'tests/ui/macros/stringify.rs')
-rw-r--r--tests/ui/macros/stringify.rs18
1 files changed, 6 insertions, 12 deletions
diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs
index 6cd64e3f430..192e6e0cc98 100644
--- a/tests/ui/macros/stringify.rs
+++ b/tests/ui/macros/stringify.rs
@@ -211,8 +211,7 @@ fn test_expr() {
     }
     c2_match_arm!(
         [ { 1 } - 1 ],
-        // FIXME(dtolnay): this is invalid syntax, needs parens.
-        "match () { _ => { 1 } - 1, }",
+        "match () { _ => ({ 1 }) - 1, }",
         "match() { _ => { 1 } - 1 }",
     );
 
@@ -669,8 +668,7 @@ fn test_stmt() {
     }
     c2_let_expr_minus_one!(
         [ match void {} ],
-        // FIXME(dtolnay): no parens needed.
-        "let _ = (match void {}) - 1;",
+        "let _ = match void {} - 1;",
         "let _ = match void {} - 1",
     );
 
@@ -706,25 +704,21 @@ fn test_stmt() {
     c2_minus_one!(
         [ match void {} ],
         "(match void {}) - 1;",
-        // FIXME(dtolnay): no parens expected.
-        "(match void {}) - 1",
+        "match void {} - 1",
     );
     c2_minus_one!(
         [ match void {}() ],
-        // FIXME(dtolnay): needs parens around match.
-        "match void {}() - 1;",
+        "(match void {})() - 1;",
         "match void {}() - 1",
     );
     c2_minus_one!(
         [ match void {}[0] ],
-        // FIXME(dtolnay): needs parens around match.
-        "match void {}[0] - 1;",
+        "(match void {})[0] - 1;",
         "match void {}[0] - 1",
     );
     c2_minus_one!(
         [ loop { break 1; } ],
-        // FIXME(dtolnay): needs parens around loop.
-        "loop { break 1; } - 1;",
+        "(loop { break 1; }) - 1;",
         "loop { break 1; } - 1",
     );