]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/dead-code/lint-dead-code-2.rs
Auto merge of #106884 - clubby789:fieldless-enum-debug, r=michaelwoerister
[rust.git] / tests / ui / lint / dead-code / lint-dead-code-2.rs
1 #![allow(unused_variables)]
2 #![deny(dead_code)]
3 #![feature(rustc_attrs, start)]
4
5 struct Foo;
6
7 trait Bar {
8     fn bar1(&self);
9     fn bar2(&self) {
10         self.bar1();
11     }
12 }
13
14 impl Bar for Foo {
15     fn bar1(&self) {
16         live_fn();
17     }
18 }
19
20 fn live_fn() {}
21
22 fn dead_fn() {} //~ ERROR: function `dead_fn` is never used
23
24 #[rustc_main]
25 fn dead_fn2() {} //~ ERROR: function `dead_fn2` is never used
26
27 fn used_fn() {}
28
29 #[start]
30 fn start(_: isize, _: *const *const u8) -> isize {
31     used_fn();
32     let foo = Foo;
33     foo.bar2();
34     0
35 }
36
37 // this is not main
38 fn main() { //~ ERROR: function `main` is never used
39     dead_fn();
40     dead_fn2();
41 }