Add an attribute-related parenthesization edge case

This commit is contained in:
David Tolnay 2025-06-13 13:26:24 -07:00
parent 12a855d2c8
commit 535e11f72e
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82

View file

@ -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",