]> git.proxmox.com Git - rustc.git/blob - src/test/ui/lint/dead-code/lint-dead-code-2.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / lint / dead-code / lint-dead-code-2.rs
1 #![allow(unused_variables)]
2 #![deny(dead_code)]
3 #![feature(main, 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 is never used
23
24 #[main]
25 fn dead_fn2() {} //~ ERROR: function 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 is never used
39 dead_fn();
40 dead_fn2();
41 }