Skip to content

Commit bf80165

Browse files
committed
add tests for using a single impl for two EIIs
1 parent 547c273 commit bf80165

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed

tests/ui/eii/multiple_decls.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Tests whether only one EII attribute cane be applied to a signature.
2+
#![feature(eii)]
3+
4+
#[eii(a)]
5+
#[eii(b)]
6+
//~^ ERROR `#[eii]` can only be specified once
7+
fn a(x: u64);
8+
9+
#[a]
10+
fn implementation(x: u64) {
11+
println!("{x:?}")
12+
}
13+
14+
// what you would write:
15+
fn main() {
16+
a(42);
17+
}

tests/ui/eii/multiple_decls.stderr

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: `#[eii]` can only be specified once
2+
--> $DIR/multiple_decls.rs:5:1
3+
|
4+
LL | #[eii(b)]
5+
| ^^^^^^^^^
6+
|
7+
note: specified again here
8+
--> $DIR/multiple_decls.rs:4:1
9+
|
10+
LL | #[eii(a)]
11+
| ^^^^^^^^^
12+
13+
error: aborting due to 1 previous error
14+

tests/ui/eii/multiple_impls.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//@ run-pass
2+
//@ check-run-results
3+
//@ ignore-backends: gcc
4+
// Tests whether one function could implement two EIIs.
5+
#![feature(eii)]
6+
7+
#[eii]
8+
fn a(x: u64);
9+
10+
#[eii]
11+
fn b(x: u64);
12+
13+
#[a]
14+
#[b]
15+
fn implementation(x: u64) {
16+
println!("{x:?}")
17+
}
18+
19+
// what you would write:
20+
fn main() {
21+
a(42);
22+
b(42);
23+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
42
2+
42

0 commit comments

Comments
 (0)