about summary refs log tree commit diff
path: root/src/test/ui/parser/stmt_expr_attrs_placement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/parser/stmt_expr_attrs_placement.rs')
-rw-r--r--src/test/ui/parser/stmt_expr_attrs_placement.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/parser/stmt_expr_attrs_placement.rs b/src/test/ui/parser/stmt_expr_attrs_placement.rs
new file mode 100644
index 00000000000..b8a794f4b92
--- /dev/null
+++ b/src/test/ui/parser/stmt_expr_attrs_placement.rs
@@ -0,0 +1,22 @@
+#![feature(stmt_expr_attributes)]
+
+// Test that various placements of the inner attribute are parsed correctly,
+// or not.
+
+fn main() {
+    let a = #![allow(warnings)] (1, 2);
+    //~^ ERROR an inner attribute is not permitted in this context
+
+    let b = (#![allow(warnings)] 1, 2);
+
+    let c = {
+        #![allow(warnings)]
+        (#![allow(warnings)] 1, 2)
+    };
+
+    let d = {
+        #![allow(warnings)]
+        let e = (#![allow(warnings)] 1, 2);
+        e
+    };
+}