Skip to content

Commit 0b7908c

Browse files
achan1989Centril
authored andcommitted
Add a UI test for correct parsing
1 parent dd15904 commit 0b7908c

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#![feature(stmt_expr_attributes)]
2+
3+
// Test that various placements of the inner attribute are parsed correctly,
4+
// or not.
5+
6+
fn main() {
7+
let a = #![allow(warnings)] (1, 2);
8+
//~^ ERROR an inner attribute is not permitted in this context
9+
10+
let b = (#![allow(warnings)] 1, 2);
11+
12+
let c = {
13+
#![allow(warnings)]
14+
(#![allow(warnings)] 1, 2)
15+
};
16+
17+
let d = {
18+
#![allow(warnings)]
19+
let e = (#![allow(warnings)] 1, 2);
20+
e
21+
};
22+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: an inner attribute is not permitted in this context
2+
--> $DIR/stmt_expr_attrs_placement.rs:7:13
3+
|
4+
LL | let a = #![allow(warnings)] (1, 2);
5+
| ^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
8+
9+
error: aborting due to previous error
10+

0 commit comments

Comments
 (0)