Skip to content

Commit d58770f

Browse files
committed
add test for rejecting EIIs in statement position
1 parent 9a69ea4 commit d58770f

2 files changed

Lines changed: 16 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: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,14 @@ 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+
LL |
13+
LL | fn foo() {}
14+
| --- `#[eii]` is used on this item, which is part of another item's local scope
15+
16+
error: aborting due to 2 previous errors
817

0 commit comments

Comments
 (0)