Skip to content

Commit c6a8c46

Browse files
add test for duplicate warning on used deprecated unit structs
Co-authored-by: Waffle Lapkin <[email protected]>
1 parent df984ed commit c6a8c46

File tree

2 files changed

+154
-0
lines changed

2 files changed

+154
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#![deny(deprecated)]
2+
#![allow(unused_imports)]
3+
4+
#[deprecated]
5+
pub mod a {
6+
pub struct Foo;
7+
pub struct Bar();
8+
pub struct Baz {}
9+
10+
pub enum Enum {
11+
VFoo,
12+
VBar(),
13+
VBaz {},
14+
}
15+
}
16+
17+
18+
use a::Foo;
19+
//~^ ERROR use of deprecated struct `a::Foo`
20+
//~| ERROR use of deprecated unit struct `a::Foo`
21+
use a::Bar;
22+
//~^ ERROR use of deprecated struct `a::Bar`
23+
//~| ERROR use of deprecated tuple struct `a::Bar`
24+
use a::Baz;
25+
//~^ ERROR use of deprecated struct `a::Baz`
26+
27+
use a::Enum::VFoo;
28+
//~^ ERROR use of deprecated variant `a::Enum::VFoo`
29+
//~| ERROR use of deprecated unit variant `a::Enum::VFoo`
30+
use a::Enum::VBar;
31+
//~^ ERROR use of deprecated variant `a::Enum::VBar`
32+
//~| ERROR use of deprecated tuple variant `a::Enum::VBar`
33+
use a::Enum::VBaz;
34+
//~^ ERROR use of deprecated variant `a::Enum::VBaz`
35+
36+
fn main() {
37+
a::Foo;
38+
//~^ ERROR use of deprecated unit struct `a::Foo`
39+
a::Bar();
40+
//~^ ERROR use of deprecated tuple struct `a::Bar`
41+
a::Baz {};
42+
//~^ ERROR use of deprecated struct `a::Baz`
43+
44+
a::Enum::VFoo;
45+
//~^ ERROR use of deprecated unit variant `a::Enum::VFoo`
46+
a::Enum::VBar();
47+
//~^ ERROR use of deprecated tuple variant `a::Enum::VBar`
48+
a::Enum::VBaz{};
49+
//~^ ERROR use of deprecated variant `a::Enum::VBaz`
50+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
error: use of deprecated struct `a::Foo`
2+
--> $DIR/unit_and_tuple_struct.rs:18:8
3+
|
4+
LL | use a::Foo;
5+
| ^^^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/unit_and_tuple_struct.rs:1:9
9+
|
10+
LL | #![deny(deprecated)]
11+
| ^^^^^^^^^^
12+
13+
error: use of deprecated unit struct `a::Foo`
14+
--> $DIR/unit_and_tuple_struct.rs:18:8
15+
|
16+
LL | use a::Foo;
17+
| ^^^
18+
19+
error: use of deprecated struct `a::Bar`
20+
--> $DIR/unit_and_tuple_struct.rs:21:8
21+
|
22+
LL | use a::Bar;
23+
| ^^^
24+
25+
error: use of deprecated tuple struct `a::Bar`
26+
--> $DIR/unit_and_tuple_struct.rs:21:8
27+
|
28+
LL | use a::Bar;
29+
| ^^^
30+
31+
error: use of deprecated struct `a::Baz`
32+
--> $DIR/unit_and_tuple_struct.rs:24:8
33+
|
34+
LL | use a::Baz;
35+
| ^^^
36+
37+
error: use of deprecated variant `a::Enum::VFoo`
38+
--> $DIR/unit_and_tuple_struct.rs:27:14
39+
|
40+
LL | use a::Enum::VFoo;
41+
| ^^^^
42+
43+
error: use of deprecated unit variant `a::Enum::VFoo`
44+
--> $DIR/unit_and_tuple_struct.rs:27:14
45+
|
46+
LL | use a::Enum::VFoo;
47+
| ^^^^
48+
49+
error: use of deprecated variant `a::Enum::VBar`
50+
--> $DIR/unit_and_tuple_struct.rs:30:14
51+
|
52+
LL | use a::Enum::VBar;
53+
| ^^^^
54+
55+
error: use of deprecated tuple variant `a::Enum::VBar`
56+
--> $DIR/unit_and_tuple_struct.rs:30:14
57+
|
58+
LL | use a::Enum::VBar;
59+
| ^^^^
60+
61+
error: use of deprecated variant `a::Enum::VBaz`
62+
--> $DIR/unit_and_tuple_struct.rs:33:14
63+
|
64+
LL | use a::Enum::VBaz;
65+
| ^^^^
66+
67+
error: use of deprecated unit struct `a::Foo`
68+
--> $DIR/unit_and_tuple_struct.rs:37:6
69+
|
70+
LL | a::Foo;
71+
| ^^^
72+
73+
error: use of deprecated tuple struct `a::Bar`
74+
--> $DIR/unit_and_tuple_struct.rs:39:6
75+
|
76+
LL | a::Bar();
77+
| ^^^
78+
79+
error: use of deprecated struct `a::Baz`
80+
--> $DIR/unit_and_tuple_struct.rs:41:6
81+
|
82+
LL | a::Baz {};
83+
| ^^^
84+
85+
error: use of deprecated unit variant `a::Enum::VFoo`
86+
--> $DIR/unit_and_tuple_struct.rs:44:12
87+
|
88+
LL | a::Enum::VFoo;
89+
| ^^^^
90+
91+
error: use of deprecated tuple variant `a::Enum::VBar`
92+
--> $DIR/unit_and_tuple_struct.rs:46:12
93+
|
94+
LL | a::Enum::VBar();
95+
| ^^^^
96+
97+
error: use of deprecated variant `a::Enum::VBaz`
98+
--> $DIR/unit_and_tuple_struct.rs:48:12
99+
|
100+
LL | a::Enum::VBaz{};
101+
| ^^^^
102+
103+
error: aborting due to 16 previous errors
104+

0 commit comments

Comments
 (0)