Skip to content

Commit 72039f3

Browse files
committed
Add test for duplicated struct
Signed-off-by: Christian Poveda <[email protected]>
1 parent ca8266e commit 72039f3

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use cyclonedx_bom_macros::versioned;
2+
3+
#[versioned("1.0", "2.0")]
4+
mod base {
5+
// Define `Foo` for 1.0 twice
6+
#[versioned("1.0")]
7+
pub struct Foo;
8+
9+
#[versioned("1.0")]
10+
pub struct Foo;
11+
}
12+
13+
fn main() {
14+
let _ = v1_0::Foo;
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error[E0428]: the name `Foo` is defined multiple times
2+
--> tests/ui/fail/duplicated_struct.rs:10:5
3+
|
4+
7 | pub struct Foo;
5+
| --------------- previous definition of the type `Foo` here
6+
...
7+
10 | pub struct Foo;
8+
| ^^^^^^^^^^^^^^^ `Foo` redefined here
9+
|
10+
= note: `Foo` must be defined only once in the type namespace of this module

0 commit comments

Comments
 (0)