Skip to content

Commit 0397f4f

Browse files
committed
add test for rejecting EIIs in statement position
1 parent 3dc998d commit 0397f4f

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

tests/ui/eii/error_statement_position.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,10 @@ fn main() {
1313
#[eii]
1414
//~^ ERROR `#[eii]` is only valid on functions
1515
impl Bar {}
16+
17+
18+
// Even on functions, eiis in statement position are rejected
19+
#[eii]
20+
//~^ ERROR `#[eii]` can only be used on functions inside a module
21+
fn foo() {}
1622
}

tests/ui/eii/error_statement_position.stderr

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,17 @@ error: `#[eii]` is only valid on functions
44
LL | #[eii]
55
| ^^^^^^
66

7-
error: aborting due to 1 previous error
7+
error: `#[eii]` can only be used on functions inside a module
8+
--> $DIR/error_statement_position.rs:19:5
9+
|
10+
LL | #[eii]
11+
| ^^^^^^
12+
|
13+
note: `#[eii]` is used on this item, which is part of another item's local scope
14+
--> $DIR/error_statement_position.rs:21:8
15+
|
16+
LL | fn foo() {}
17+
| ^^^
18+
19+
error: aborting due to 2 previous errors
820

0 commit comments

Comments
 (0)