about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2025-06-13 13:26:24 -0700
committerDavid Tolnay <dtolnay@gmail.com>2025-06-20 13:49:12 -0700
commit535e11f72e0c2460fac74aa0625b47fb0ff43ec6 (patch)
tree1f357bd2c289c6ff68a56cf657ea58efdbb94a19 /tests
parent12a855d2c8420032700c5e3df32d07e0e12d3647 (diff)
downloadrust-535e11f72e0c2460fac74aa0625b47fb0ff43ec6.tar.gz
rust-535e11f72e0c2460fac74aa0625b47fb0ff43ec6.zip
Add an attribute-related parenthesization edge case
Diffstat (limited to 'tests')
-rw-r--r--tests/ui-fulldeps/pprust-parenthesis-insertion.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/ui-fulldeps/pprust-parenthesis-insertion.rs b/tests/ui-fulldeps/pprust-parenthesis-insertion.rs
index 346b8ed5fda..72b5cfb9063 100644
--- a/tests/ui-fulldeps/pprust-parenthesis-insertion.rs
+++ b/tests/ui-fulldeps/pprust-parenthesis-insertion.rs
@@ -101,6 +101,12 @@ static EXPRS: &[&str] = &[
     "#[attr] (x += 1)",
     "#[attr] (lo..hi)",
     "#[attr] (..hi)",
+    // If the attribute were not present on the binary operation, it would be
+    // legal to render this without not just the inner parentheses, but also the
+    // outer ones. `return x + .. .field` (Yes, really.) Currently the
+    // pretty-printer does not take advantage of this edge case.
+    "(return #[attr] (x + ..)).field",
+    "(return x + ..).field",
     // Grammar restriction: break value starting with a labeled loop is not
     // allowed, except if the break is also labeled.
     "break 'outer 'inner: loop {} + 2",