]> git.lizzy.rs Git - rust.git/blob - tests/ui/liveness/liveness-derive.rs
Rollup merge of #106766 - GuillaumeGomez:rm-stripper-dead-code, r=notriddle
[rust.git] / tests / ui / liveness / liveness-derive.rs
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; //~ WARN unused variable: `a`
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() {}