File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Test for interaction between #[automatically_derived] attribute used by
2
+ // built-in derives and lints generated by liveness pass.
3
+ //
4
+ // edition:2018
5
+ // check-pass
6
+ #![warn(unused)]
7
+
8
+ pub trait T: Sized {
9
+ const N: usize;
10
+ fn t(&self) -> Self;
11
+ }
12
+
13
+ impl T for u32 {
14
+ const N: usize = {
15
+ let a = 0; // FIXME should warn about unused variable
16
+ 4
17
+ };
18
+
19
+ fn t(&self) -> Self {
20
+ let b = 16; //~ WARN unused variable: `b`
21
+ 0
22
+ }
23
+ }
24
+
25
+ #[automatically_derived]
26
+ impl T for i32 {
27
+ const N: usize = {
28
+ let c = 0;
29
+ 4
30
+ };
31
+
32
+ fn t(&self) -> Self {
33
+ let d = 17;
34
+ 0
35
+ }
36
+ }
37
+
38
+ fn main() {}
Original file line number Diff line number Diff line change
1
+ warning: unused variable: `b`
2
+ --> $DIR/liveness-derive.rs:20:13
3
+ |
4
+ LL | let b = 16;
5
+ | ^ help: if this is intentional, prefix it with an underscore: `_b`
6
+ |
7
+ note: the lint level is defined here
8
+ --> $DIR/liveness-derive.rs:6:9
9
+ |
10
+ LL | #![warn(unused)]
11
+ | ^^^^^^
12
+ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]`
13
+
14
+ warning: 1 warning emitted
15
+
You can’t perform that action at this time.
0 commit comments