about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-04-23 12:10:26 +0200
committerGitHub <noreply@github.com>2024-04-23 12:10:26 +0200
commit9c0e5f2c34e35eb77c120a01ced1d7cb657f259b (patch)
treedc5c46a83b4c8832498ba65ab756302065f5addb
parent932f3ab7625fc65b733f04f49d60f6c27644fdee (diff)
parent966dd60251152809b82050ae04fdc18a0ac909c6 (diff)
downloadrust-9c0e5f2c34e35eb77c120a01ced1d7cb657f259b.tar.gz
rust-9c0e5f2c34e35eb77c120a01ced1d7cb657f259b.zip
Rollup merge of #124099 - voidc:disallow-ambiguous-expr-attrs, r=davidtwco
Disallow ambiguous attributes on expressions

This implements the suggestion in [#15701](https://github.com/rust-lang/rust/issues/15701#issuecomment-2033124217) to disallow ambiguous outer attributes on expressions. This should resolve one of the concerns blocking the stabilization of `stmt_expr_attributes`.
-rw-r--r--tests/source/attrib.rs4
-rw-r--r--tests/target/attrib.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/source/attrib.rs b/tests/source/attrib.rs
index d45fba55224..fc13cd02b03 100644
--- a/tests/source/attrib.rs
+++ b/tests/source/attrib.rs
@@ -214,8 +214,8 @@ type Os = NoSource;
 // #3313
 fn stmt_expr_attributes() {
     let foo ;
-    #[must_use]
-   foo = false ;
+    (#[must_use]
+   foo) = false ;
 }
 
 // #3509
diff --git a/tests/target/attrib.rs b/tests/target/attrib.rs
index 7e61f68d76a..7b3309676de 100644
--- a/tests/target/attrib.rs
+++ b/tests/target/attrib.rs
@@ -248,8 +248,8 @@ type Os = NoSource;
 // #3313
 fn stmt_expr_attributes() {
     let foo;
-    #[must_use]
-    foo = false;
+    (#[must_use]
+    foo) = false;
 }
 
 // #3509