2014-10-27 15:37:07 -07:00
|
|
|
#![allow(unused_variables)]
|
2014-03-21 18:05:05 -07:00
|
|
|
#![deny(dead_code)]
|
2024-12-14 09:13:12 +01:00
|
|
|
#![feature(rustc_attrs)]
|
2013-12-08 02:55:27 -05:00
|
|
|
|
|
|
|
|
struct Foo;
|
|
|
|
|
|
|
|
|
|
trait Bar {
|
|
|
|
|
fn bar1(&self);
|
|
|
|
|
fn bar2(&self) {
|
|
|
|
|
self.bar1();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Bar for Foo {
|
|
|
|
|
fn bar1(&self) {
|
|
|
|
|
live_fn();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn live_fn() {}
|
|
|
|
|
|
2022-06-10 12:14:24 +09:00
|
|
|
fn dead_fn() {} //~ ERROR: function `dead_fn` is never used
|
2013-12-08 02:55:27 -05:00
|
|
|
|
|
|
|
|
fn used_fn() {}
|
|
|
|
|
|
2024-12-14 09:13:12 +01:00
|
|
|
#[rustc_main]
|
|
|
|
|
fn actual_main() {
|
2013-12-08 02:55:27 -05:00
|
|
|
used_fn();
|
|
|
|
|
let foo = Foo;
|
|
|
|
|
foo.bar2();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// this is not main
|
2022-06-10 12:14:24 +09:00
|
|
|
fn main() { //~ ERROR: function `main` is never used
|
2013-12-08 02:55:27 -05:00
|
|
|
dead_fn();
|
|
|
|
|
}
|