This helps organize the tests better. I also renamed several of the tests to remove redundant dead-code in the path, and better match what they're testing
+++ /dev/null
-// run-pass
-
-#![deny(dead_code)]
-
-fn main() {
- struct Foo<T> { x: T }
- type Bar = Foo<u32>;
- let spam = |Bar { x }| x != 0;
- println!("{}", spam(Foo { x: 10 }));
-}
+++ /dev/null
-// ignore-test FIXME(#20574)
-
-#![deny(unreachable_code)]
-
-fn main() {
- let x = || panic!();
- x();
- println!("Foo bar"); //~ ERROR: unreachable statement
-}
+++ /dev/null
-// run-pass
-
-#![deny(dead_code)]
-
-pub struct GenericFoo<T>(T);
-
-type Foo = GenericFoo<u32>;
-
-impl Foo {
- fn bar(self) -> u8 {
- 0
- }
-}
-
-fn main() {
- println!("{}", GenericFoo(0).bar());
-}
+++ /dev/null
-// run-pass
-// pretty-expanded FIXME #23616
-
-#![deny(dead_code)]
-
-static _X: usize = 0;
-
-fn _foo() {}
-
-struct _Y {
- _z: usize
-}
-
-enum _Z {}
-
-impl _Y {
- fn _bar() {}
-}
-
-type _A = isize;
-
-mod _bar {
- fn _qux() {}
-}
-
-extern {
- #[link_name = "abort"]
- fn _abort() -> !;
-}
-
-pub fn main() {}
+++ /dev/null
-// build-pass (FIXME(62277): could be check-pass?)
-
-#![deny(dead_code)]
-
-const LEN: usize = 4;
-
-#[derive(Debug)]
-struct Wrapper([u8; LEN]);
-
-fn main() {
- println!("{:?}", Wrapper([0, 1, 2, 3]));
-}
+++ /dev/null
-#![deny(dead_code)]
-#![allow(unreachable_code)]
-
-#[macro_use]
-extern crate core;
-
-fn foo() { //~ ERROR function is never used
-
- // none of these should have any dead_code exposed to the user
- panic!();
-
- panic!("foo");
-
- panic!("bar {}", "baz")
-}
-
-
-fn main() {}
+++ /dev/null
-error: function is never used: `foo`
- --> $DIR/fail-no-dead-code-core.rs:7:1
- |
-LL | fn foo() {
- | ^^^^^^^^
- |
-note: lint level defined here
- --> $DIR/fail-no-dead-code-core.rs:1:9
- |
-LL | #![deny(dead_code)]
- | ^^^^^^^^^
-
-error: aborting due to previous error
-
+++ /dev/null
-#![deny(dead_code)]
-#![allow(unreachable_code)]
-
-fn foo() { //~ ERROR function is never used
-
- // none of these should have any dead_code exposed to the user
- panic!();
-
- panic!("foo");
-
- panic!("bar {}", "baz")
-}
-
-
-fn main() {}
+++ /dev/null
-error: function is never used: `foo`
- --> $DIR/fail-no-dead-code.rs:4:1
- |
-LL | fn foo() {
- | ^^^^^^^^
- |
-note: lint level defined here
- --> $DIR/fail-no-dead-code.rs:1:9
- |
-LL | #![deny(dead_code)]
- | ^^^^^^^^^
-
-error: aborting due to previous error
-
+++ /dev/null
-// run-pass
-
-#![deny(dead_code)]
-
-trait Foo {
- type Bar;
-}
-
-struct Used;
-
-struct Ex;
-
-impl Foo for Ex {
- type Bar = Used;
-}
-
-pub fn main() {
- let _x = Ex;
-}
+++ /dev/null
-// run-pass
-
-#![deny(dead_code)]
-
-enum Foo {
- A,
- B,
-}
-
-pub fn main() {
- match Foo::A {
- Foo::A | Foo::B => Foo::B
- };
-}
--- /dev/null
+// run-pass
+
+#![deny(dead_code)]
+
+fn main() {
+ struct Foo<T> { x: T }
+ type Bar = Foo<u32>;
+ let spam = |Bar { x }| x != 0;
+ println!("{}", spam(Foo { x: 10 }));
+}
--- /dev/null
+// run-pass
+
+#![deny(dead_code)]
+
+trait Foo {
+ type Bar;
+}
+
+struct Used;
+
+struct Ex;
+
+impl Foo for Ex {
+ type Bar = Used;
+}
+
+pub fn main() {
+ let _x = Ex;
+}
--- /dev/null
+#![deny(dead_code)]
+#![allow(unreachable_code)]
+
+fn foo() { //~ ERROR function is never used
+
+ // none of these should have any dead_code exposed to the user
+ panic!();
+
+ panic!("foo");
+
+ panic!("bar {}", "baz")
+}
+
+
+fn main() {}
--- /dev/null
+error: function is never used: `foo`
+ --> $DIR/basic.rs:4:1
+ |
+LL | fn foo() {
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/basic.rs:1:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// ignore-test FIXME(#20574)
+
+#![deny(unreachable_code)]
+
+fn main() {
+ let x = || panic!();
+ x();
+ println!("Foo bar"); //~ ERROR: unreachable statement
+}
--- /dev/null
+// check-pass
+
+#![deny(dead_code)]
+
+const TLC: usize = 4;
+
+trait Tr { fn doit(&self); }
+
+impl Tr for [usize; TLC] {
+ fn doit(&self) {
+ println!("called 4");
+ }
+}
+
+struct X;
+struct Y;
+struct Z;
+
+trait Foo<T> {
+ type Ty;
+ fn foo() -> Self::Ty;
+}
+
+impl Foo<Y> for X {
+ type Ty = Z;
+ fn foo() -> Self::Ty {
+ unimplemented!()
+ }
+}
+
+fn main() {
+ let s = [0,1,2,3];
+ s.doit();
+ X::foo();
+}
--- /dev/null
+#![deny(unused)]
+
+enum E {} //~ ERROR enum is never used
+
+fn main() {}
--- /dev/null
+error: enum is never used: `E`
+ --> $DIR/empty-unused-enum.rs:3:1
+ |
+LL | enum E {}
+ | ^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/empty-unused-enum.rs:1:9
+ |
+LL | #![deny(unused)]
+ | ^^^^^^
+ = note: `#[deny(dead_code)]` implied by `#[deny(unused)]`
+
+error: aborting due to previous error
+
--- /dev/null
+// build-pass
+#![deny(unused)]
+
+pub enum E {}
+
+fn main() {}
--- /dev/null
+// run-pass
+
+#![deny(dead_code)]
+
+enum Foo {
+ A,
+ B,
+}
+
+pub fn main() {
+ match Foo::A {
+ Foo::A | Foo::B => Foo::B
+ };
+}
--- /dev/null
+#![deny(dead_code)]
+
+trait Trait {
+ type Type;
+}
+
+impl Trait for () {
+ type Type = ();
+}
+
+type Used = ();
+type Unused = (); //~ ERROR type alias is never used
+
+fn foo() -> impl Trait<Type = Used> {}
+
+fn main() {
+ foo();
+}
--- /dev/null
+error: type alias is never used: `Unused`
+ --> $DIR/impl-trait.rs:12:1
+ |
+LL | type Unused = ();
+ | ^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/impl-trait.rs:1:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// run-pass
+// pretty-expanded FIXME #23616
+
+#![deny(dead_code)]
+
+static _X: usize = 0;
+
+fn _foo() {}
+
+struct _Y {
+ _z: usize
+}
+
+enum _Z {}
+
+impl _Y {
+ fn _bar() {}
+}
+
+type _A = isize;
+
+mod _bar {
+ fn _qux() {}
+}
+
+extern {
+ #[link_name = "abort"]
+ fn _abort() -> !;
+}
+
+pub fn main() {}
--- /dev/null
+#![no_std]
+#![allow(unused_variables)]
+#![allow(non_camel_case_types)]
+#![allow(non_upper_case_globals)]
+#![deny(dead_code)]
+
+#![crate_type="lib"]
+
+pub use foo2::Bar2;
+
+mod foo {
+ pub struct Bar; //~ ERROR: struct is never constructed
+}
+
+mod foo2 {
+ pub struct Bar2;
+}
+
+pub static pub_static: isize = 0;
+static priv_static: isize = 0; //~ ERROR: static item is never used
+const used_static: isize = 0;
+pub static used_static2: isize = used_static;
+const USED_STATIC: isize = 0;
+const STATIC_USED_IN_ENUM_DISCRIMINANT: isize = 10;
+
+pub const pub_const: isize = 0;
+const priv_const: isize = 0; //~ ERROR: constant item is never used
+const used_const: isize = 0;
+pub const used_const2: isize = used_const;
+const USED_CONST: isize = 1;
+const CONST_USED_IN_ENUM_DISCRIMINANT: isize = 11;
+
+pub type typ = *const UsedStruct4;
+pub struct PubStruct;
+struct PrivStruct; //~ ERROR: struct is never constructed
+struct UsedStruct1 {
+ #[allow(dead_code)]
+ x: isize
+}
+struct UsedStruct2(isize);
+struct UsedStruct3;
+pub struct UsedStruct4;
+// this struct is never used directly, but its method is, so we don't want
+// to warn it
+struct SemiUsedStruct;
+impl SemiUsedStruct {
+ fn la_la_la() {}
+}
+struct StructUsedAsField;
+pub struct StructUsedInEnum;
+struct StructUsedInGeneric;
+pub struct PubStruct2 {
+ #[allow(dead_code)]
+ struct_used_as_field: *const StructUsedAsField
+}
+
+pub enum pub_enum { foo1, bar1 }
+pub enum pub_enum2 { a(*const StructUsedInEnum) }
+pub enum pub_enum3 {
+ Foo = STATIC_USED_IN_ENUM_DISCRIMINANT,
+ Bar = CONST_USED_IN_ENUM_DISCRIMINANT,
+}
+
+enum priv_enum { foo2, bar2 } //~ ERROR: enum is never used
+enum used_enum {
+ foo3,
+ bar3 //~ ERROR variant is never constructed
+}
+
+fn f<T>() {}
+
+pub fn pub_fn() {
+ used_fn();
+ let used_struct1 = UsedStruct1 { x: 1 };
+ let used_struct2 = UsedStruct2(1);
+ let used_struct3 = UsedStruct3;
+ let e = used_enum::foo3;
+ SemiUsedStruct::la_la_la();
+
+ let i = 1;
+ match i {
+ USED_STATIC => (),
+ USED_CONST => (),
+ _ => ()
+ }
+ f::<StructUsedInGeneric>();
+}
+fn priv_fn() { //~ ERROR: function is never used
+ let unused_struct = PrivStruct;
+}
+fn used_fn() {}
+
+fn foo() { //~ ERROR: function is never used
+ bar();
+ let unused_enum = priv_enum::foo2;
+}
+
+fn bar() { //~ ERROR: function is never used
+ foo();
+}
+
+fn baz() -> impl Copy { //~ ERROR: function is never used
+ "I'm unused, too"
+}
+
+// Code with #[allow(dead_code)] should be marked live (and thus anything it
+// calls is marked live)
+#[allow(dead_code)]
+fn g() { h(); }
+fn h() {}
--- /dev/null
+error: struct is never constructed: `Bar`
+ --> $DIR/lint-dead-code-1.rs:12:5
+ |
+LL | pub struct Bar;
+ | ^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-dead-code-1.rs:5:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: static item is never used: `priv_static`
+ --> $DIR/lint-dead-code-1.rs:20:1
+ |
+LL | static priv_static: isize = 0;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: constant item is never used: `priv_const`
+ --> $DIR/lint-dead-code-1.rs:27:1
+ |
+LL | const priv_const: isize = 0;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: struct is never constructed: `PrivStruct`
+ --> $DIR/lint-dead-code-1.rs:35:1
+ |
+LL | struct PrivStruct;
+ | ^^^^^^^^^^^^^^^^^^
+
+error: enum is never used: `priv_enum`
+ --> $DIR/lint-dead-code-1.rs:64:1
+ |
+LL | enum priv_enum { foo2, bar2 }
+ | ^^^^^^^^^^^^^^
+
+error: variant is never constructed: `bar3`
+ --> $DIR/lint-dead-code-1.rs:67:5
+ |
+LL | bar3
+ | ^^^^
+
+error: function is never used: `priv_fn`
+ --> $DIR/lint-dead-code-1.rs:88:1
+ |
+LL | fn priv_fn() {
+ | ^^^^^^^^^^^^
+
+error: function is never used: `foo`
+ --> $DIR/lint-dead-code-1.rs:93:1
+ |
+LL | fn foo() {
+ | ^^^^^^^^
+
+error: function is never used: `bar`
+ --> $DIR/lint-dead-code-1.rs:98:1
+ |
+LL | fn bar() {
+ | ^^^^^^^^
+
+error: function is never used: `baz`
+ --> $DIR/lint-dead-code-1.rs:102:1
+ |
+LL | fn baz() -> impl Copy {
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 10 previous errors
+
--- /dev/null
+#![allow(unused_variables)]
+#![deny(dead_code)]
+#![feature(main, start)]
+
+struct Foo;
+
+trait Bar {
+ fn bar1(&self);
+ fn bar2(&self) {
+ self.bar1();
+ }
+}
+
+impl Bar for Foo {
+ fn bar1(&self) {
+ live_fn();
+ }
+}
+
+fn live_fn() {}
+
+fn dead_fn() {} //~ ERROR: function is never used
+
+#[main]
+fn dead_fn2() {} //~ ERROR: function is never used
+
+fn used_fn() {}
+
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
+ used_fn();
+ let foo = Foo;
+ foo.bar2();
+ 0
+}
+
+// this is not main
+fn main() { //~ ERROR: function is never used
+ dead_fn();
+ dead_fn2();
+}
--- /dev/null
+error: function is never used: `dead_fn`
+ --> $DIR/lint-dead-code-2.rs:22:1
+ |
+LL | fn dead_fn() {}
+ | ^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-dead-code-2.rs:2:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: function is never used: `dead_fn2`
+ --> $DIR/lint-dead-code-2.rs:25:1
+ |
+LL | fn dead_fn2() {}
+ | ^^^^^^^^^^^^^
+
+error: function is never used: `main`
+ --> $DIR/lint-dead-code-2.rs:38:1
+ |
+LL | fn main() {
+ | ^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
--- /dev/null
+#![allow(unused_variables)]
+#![allow(non_camel_case_types)]
+#![deny(dead_code)]
+
+#![crate_type="lib"]
+
+
+pub use extern_foo as x;
+extern {
+ pub fn extern_foo();
+}
+
+struct Foo; //~ ERROR: struct is never constructed
+impl Foo {
+ fn foo(&self) { //~ ERROR: method is never used
+ bar()
+ }
+}
+
+fn bar() { //~ ERROR: function is never used
+ fn baz() {}
+
+ Foo.foo();
+ baz();
+}
+
+// no warning
+struct Foo2;
+impl Foo2 { fn foo2(&self) { bar2() } }
+fn bar2() {
+ fn baz2() {}
+
+ Foo2.foo2();
+ baz2();
+}
+
+pub fn pub_fn() {
+ let foo2_struct = Foo2;
+ foo2_struct.foo2();
+
+ blah::baz();
+}
+
+mod blah {
+ // not warned because it's used in the parameter of `free` and return of
+ // `malloc` below, which are also used.
+ enum c_void {}
+
+ extern {
+ fn free(p: *const c_void);
+ fn malloc(size: usize) -> *const c_void;
+ }
+
+ pub fn baz() {
+ unsafe { free(malloc(4)); }
+ }
+}
+
+enum c_void {} //~ ERROR: enum is never used
+extern {
+ fn free(p: *const c_void); //~ ERROR: foreign function is never used
+}
+
+// Check provided method
+mod inner {
+ pub trait Trait {
+ fn f(&self) { f(); }
+ }
+
+ impl Trait for isize {}
+
+ fn f() {}
+}
+
+pub fn foo() {
+ let a: &dyn inner::Trait = &1_isize;
+ a.f();
+}
--- /dev/null
+error: struct is never constructed: `Foo`
+ --> $DIR/lint-dead-code-3.rs:13:1
+ |
+LL | struct Foo;
+ | ^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-dead-code-3.rs:3:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: method is never used: `foo`
+ --> $DIR/lint-dead-code-3.rs:15:5
+ |
+LL | fn foo(&self) {
+ | ^^^^^^^^^^^^^
+
+error: function is never used: `bar`
+ --> $DIR/lint-dead-code-3.rs:20:1
+ |
+LL | fn bar() {
+ | ^^^^^^^^
+
+error: enum is never used: `c_void`
+ --> $DIR/lint-dead-code-3.rs:59:1
+ |
+LL | enum c_void {}
+ | ^^^^^^^^^^^
+
+error: foreign function is never used: `free`
+ --> $DIR/lint-dead-code-3.rs:61:5
+ |
+LL | fn free(p: *const c_void);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
--- /dev/null
+#![allow(unused_variables)]
+#![allow(non_camel_case_types)]
+#![deny(dead_code)]
+
+struct Foo {
+ x: usize,
+ b: bool, //~ ERROR: field is never used
+}
+
+fn field_read(f: Foo) -> usize {
+ f.x.pow(2)
+}
+
+enum XYZ {
+ X, //~ ERROR variant is never constructed
+ Y { //~ ERROR variant is never constructed
+ a: String,
+ b: i32,
+ c: i32,
+ },
+ Z
+}
+
+enum ABC { //~ ERROR enum is never used
+ A,
+ B {
+ a: String,
+ b: i32,
+ c: i32,
+ },
+ C
+}
+
+// ensure struct variants get warning for their fields
+enum IJK {
+ I, //~ ERROR variant is never constructed
+ J {
+ a: String,
+ b: i32, //~ ERROR field is never used
+ c: i32, //~ ERROR field is never used
+ },
+ K //~ ERROR variant is never constructed
+
+}
+
+fn struct_variant_partial_use(b: IJK) -> String {
+ match b {
+ IJK::J { a, b: _, .. } => a,
+ _ => "".to_string()
+ }
+}
+
+fn field_match_in_patterns(b: XYZ) -> String {
+ match b {
+ XYZ::Y { a, b: _, .. } => a,
+ _ => "".to_string()
+ }
+}
+
+struct Bar {
+ x: usize, //~ ERROR: field is never used
+ b: bool,
+ c: bool, //~ ERROR: field is never used
+ _guard: ()
+}
+
+#[repr(C)]
+struct Baz {
+ x: u32,
+}
+
+fn field_match_in_let(f: Bar) -> bool {
+ let Bar { b, c: _, .. } = f;
+ b
+}
+
+fn main() {
+ field_read(Foo { x: 1, b: false });
+ field_match_in_patterns(XYZ::Z);
+ struct_variant_partial_use(IJK::J { a: "".into(), b: 1, c: -1 });
+ field_match_in_let(Bar { x: 42, b: true, c: false, _guard: () });
+ let _ = Baz { x: 0 };
+}
--- /dev/null
+error: field is never used: `b`
+ --> $DIR/lint-dead-code-4.rs:7:5
+ |
+LL | b: bool,
+ | ^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-dead-code-4.rs:3:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: variant is never constructed: `X`
+ --> $DIR/lint-dead-code-4.rs:15:5
+ |
+LL | X,
+ | ^
+
+error: variant is never constructed: `Y`
+ --> $DIR/lint-dead-code-4.rs:16:5
+ |
+LL | / Y {
+LL | | a: String,
+LL | | b: i32,
+LL | | c: i32,
+LL | | },
+ | |_____^
+
+error: enum is never used: `ABC`
+ --> $DIR/lint-dead-code-4.rs:24:1
+ |
+LL | enum ABC {
+ | ^^^^^^^^
+
+error: variant is never constructed: `I`
+ --> $DIR/lint-dead-code-4.rs:36:5
+ |
+LL | I,
+ | ^
+
+error: field is never used: `b`
+ --> $DIR/lint-dead-code-4.rs:39:9
+ |
+LL | b: i32,
+ | ^^^^^^
+
+error: field is never used: `c`
+ --> $DIR/lint-dead-code-4.rs:40:9
+ |
+LL | c: i32,
+ | ^^^^^^
+
+error: variant is never constructed: `K`
+ --> $DIR/lint-dead-code-4.rs:42:5
+ |
+LL | K
+ | ^
+
+error: field is never used: `x`
+ --> $DIR/lint-dead-code-4.rs:61:5
+ |
+LL | x: usize,
+ | ^^^^^^^^
+
+error: field is never used: `c`
+ --> $DIR/lint-dead-code-4.rs:63:5
+ |
+LL | c: bool,
+ | ^^^^^^^
+
+error: aborting due to 10 previous errors
+
--- /dev/null
+#![allow(unused_variables)]
+#![deny(dead_code)]
+
+enum Enum1 {
+ Variant1(isize),
+ Variant2 //~ ERROR: variant is never constructed
+}
+
+enum Enum2 {
+ Variant3(bool),
+ #[allow(dead_code)]
+ Variant4(isize),
+ Variant5 { _x: isize }, //~ ERROR: variant is never constructed: `Variant5`
+ Variant6(isize), //~ ERROR: variant is never constructed: `Variant6`
+ _Variant7,
+}
+
+enum Enum3 { //~ ERROR: enum is never used
+ Variant8,
+ Variant9
+}
+
+fn main() {
+ let v = Enum1::Variant1(1);
+ match v {
+ Enum1::Variant1(_) => (),
+ Enum1::Variant2 => ()
+ }
+ let x = Enum2::Variant3(true);
+}
--- /dev/null
+error: variant is never constructed: `Variant2`
+ --> $DIR/lint-dead-code-5.rs:6:5
+ |
+LL | Variant2
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-dead-code-5.rs:2:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: variant is never constructed: `Variant5`
+ --> $DIR/lint-dead-code-5.rs:13:5
+ |
+LL | Variant5 { _x: isize },
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: variant is never constructed: `Variant6`
+ --> $DIR/lint-dead-code-5.rs:14:5
+ |
+LL | Variant6(isize),
+ | ^^^^^^^^^^^^^^^
+
+error: enum is never used: `Enum3`
+ --> $DIR/lint-dead-code-5.rs:18:1
+ |
+LL | enum Enum3 {
+ | ^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
--- /dev/null
+// build-pass (FIXME(62277): could be check-pass?)
+
+#![deny(dead_code)]
+
+const LEN: usize = 4;
+
+#[derive(Debug)]
+struct Wrapper([u8; LEN]);
+
+fn main() {
+ println!("{:?}", Wrapper([0, 1, 2, 3]));
+}
--- /dev/null
+#![deny(dead_code)]
+
+type Used = u8;
+type Unused = u8; //~ ERROR type alias is never used
+
+fn id(x: Used) -> Used { x }
+
+fn main() {
+ id(0);
+}
--- /dev/null
+error: type alias is never used: `Unused`
+ --> $DIR/type-alias.rs:4:1
+ |
+LL | type Unused = u8;
+ | ^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/type-alias.rs:1:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+#![deny(unused)]
+
+struct F; //~ ERROR struct is never constructed
+struct B; //~ ERROR struct is never constructed
+
+enum E { //~ ERROR enum is never used
+ Foo(F),
+ Bar(B),
+}
+
+fn main() {}
--- /dev/null
+error: struct is never constructed: `F`
+ --> $DIR/unused-enum.rs:3:1
+ |
+LL | struct F;
+ | ^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/unused-enum.rs:1:9
+ |
+LL | #![deny(unused)]
+ | ^^^^^^
+ = note: `#[deny(dead_code)]` implied by `#[deny(unused)]`
+
+error: struct is never constructed: `B`
+ --> $DIR/unused-enum.rs:4:1
+ |
+LL | struct B;
+ | ^^^^^^^^^
+
+error: enum is never used: `E`
+ --> $DIR/unused-enum.rs:6:1
+ |
+LL | enum E {
+ | ^^^^^^
+
+error: aborting due to 3 previous errors
+
--- /dev/null
+#![deny(unused)]
+
+struct F;
+struct B;
+
+enum E {
+ Foo(F),
+ Bar(B), //~ ERROR variant is never constructed
+}
+
+fn main() {
+ let _ = E::Foo(F);
+}
--- /dev/null
+error: variant is never constructed: `Bar`
+ --> $DIR/unused-struct-variant.rs:8:5
+ |
+LL | Bar(B),
+ | ^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/unused-struct-variant.rs:1:9
+ |
+LL | #![deny(unused)]
+ | ^^^^^^
+ = note: `#[deny(dead_code)]` implied by `#[deny(unused)]`
+
+error: aborting due to previous error
+
--- /dev/null
+// build-pass
+#![deny(unused)]
+
+pub struct F;
+pub struct B;
+
+pub enum E {
+ Foo(F),
+ Bar(B),
+}
+
+fn main() {
+ let _ = E::Foo(F);
+}
--- /dev/null
+#![deny(dead_code)]
+
+#[derive(Clone)]
+enum Enum {
+ Variant1, //~ ERROR: variant is never constructed
+ Variant2,
+}
+
+fn main() {
+ let e = Enum::Variant2;
+ e.clone();
+}
--- /dev/null
+error: variant is never constructed: `Variant1`
+ --> $DIR/unused-variant.rs:5:5
+ |
+LL | Variant1,
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/unused-variant.rs:1:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+#![deny(dead_code)]
+#![allow(unreachable_code)]
+
+#[macro_use]
+extern crate core;
+
+fn foo() { //~ ERROR function is never used
+
+ // none of these should have any dead_code exposed to the user
+ panic!();
+
+ panic!("foo");
+
+ panic!("bar {}", "baz")
+}
+
+
+fn main() {}
--- /dev/null
+error: function is never used: `foo`
+ --> $DIR/with-core-crate.rs:7:1
+ |
+LL | fn foo() {
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/with-core-crate.rs:1:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// run-pass
+
+#![deny(dead_code)]
+
+pub struct GenericFoo<T>(T);
+
+type Foo = GenericFoo<u32>;
+
+impl Foo {
+ fn bar(self) -> u8 {
+ 0
+ }
+}
+
+fn main() {
+ println!("{}", GenericFoo(0).bar());
+}
+++ /dev/null
-#![no_std]
-#![allow(unused_variables)]
-#![allow(non_camel_case_types)]
-#![allow(non_upper_case_globals)]
-#![deny(dead_code)]
-
-#![crate_type="lib"]
-
-pub use foo2::Bar2;
-
-mod foo {
- pub struct Bar; //~ ERROR: struct is never constructed
-}
-
-mod foo2 {
- pub struct Bar2;
-}
-
-pub static pub_static: isize = 0;
-static priv_static: isize = 0; //~ ERROR: static item is never used
-const used_static: isize = 0;
-pub static used_static2: isize = used_static;
-const USED_STATIC: isize = 0;
-const STATIC_USED_IN_ENUM_DISCRIMINANT: isize = 10;
-
-pub const pub_const: isize = 0;
-const priv_const: isize = 0; //~ ERROR: constant item is never used
-const used_const: isize = 0;
-pub const used_const2: isize = used_const;
-const USED_CONST: isize = 1;
-const CONST_USED_IN_ENUM_DISCRIMINANT: isize = 11;
-
-pub type typ = *const UsedStruct4;
-pub struct PubStruct;
-struct PrivStruct; //~ ERROR: struct is never constructed
-struct UsedStruct1 {
- #[allow(dead_code)]
- x: isize
-}
-struct UsedStruct2(isize);
-struct UsedStruct3;
-pub struct UsedStruct4;
-// this struct is never used directly, but its method is, so we don't want
-// to warn it
-struct SemiUsedStruct;
-impl SemiUsedStruct {
- fn la_la_la() {}
-}
-struct StructUsedAsField;
-pub struct StructUsedInEnum;
-struct StructUsedInGeneric;
-pub struct PubStruct2 {
- #[allow(dead_code)]
- struct_used_as_field: *const StructUsedAsField
-}
-
-pub enum pub_enum { foo1, bar1 }
-pub enum pub_enum2 { a(*const StructUsedInEnum) }
-pub enum pub_enum3 {
- Foo = STATIC_USED_IN_ENUM_DISCRIMINANT,
- Bar = CONST_USED_IN_ENUM_DISCRIMINANT,
-}
-
-enum priv_enum { foo2, bar2 } //~ ERROR: enum is never used
-enum used_enum {
- foo3,
- bar3 //~ ERROR variant is never constructed
-}
-
-fn f<T>() {}
-
-pub fn pub_fn() {
- used_fn();
- let used_struct1 = UsedStruct1 { x: 1 };
- let used_struct2 = UsedStruct2(1);
- let used_struct3 = UsedStruct3;
- let e = used_enum::foo3;
- SemiUsedStruct::la_la_la();
-
- let i = 1;
- match i {
- USED_STATIC => (),
- USED_CONST => (),
- _ => ()
- }
- f::<StructUsedInGeneric>();
-}
-fn priv_fn() { //~ ERROR: function is never used
- let unused_struct = PrivStruct;
-}
-fn used_fn() {}
-
-fn foo() { //~ ERROR: function is never used
- bar();
- let unused_enum = priv_enum::foo2;
-}
-
-fn bar() { //~ ERROR: function is never used
- foo();
-}
-
-fn baz() -> impl Copy { //~ ERROR: function is never used
- "I'm unused, too"
-}
-
-// Code with #[allow(dead_code)] should be marked live (and thus anything it
-// calls is marked live)
-#[allow(dead_code)]
-fn g() { h(); }
-fn h() {}
+++ /dev/null
-error: struct is never constructed: `Bar`
- --> $DIR/lint-dead-code-1.rs:12:5
- |
-LL | pub struct Bar;
- | ^^^^^^^^^^^^^^^
- |
-note: lint level defined here
- --> $DIR/lint-dead-code-1.rs:5:9
- |
-LL | #![deny(dead_code)]
- | ^^^^^^^^^
-
-error: static item is never used: `priv_static`
- --> $DIR/lint-dead-code-1.rs:20:1
- |
-LL | static priv_static: isize = 0;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: constant item is never used: `priv_const`
- --> $DIR/lint-dead-code-1.rs:27:1
- |
-LL | const priv_const: isize = 0;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: struct is never constructed: `PrivStruct`
- --> $DIR/lint-dead-code-1.rs:35:1
- |
-LL | struct PrivStruct;
- | ^^^^^^^^^^^^^^^^^^
-
-error: enum is never used: `priv_enum`
- --> $DIR/lint-dead-code-1.rs:64:1
- |
-LL | enum priv_enum { foo2, bar2 }
- | ^^^^^^^^^^^^^^
-
-error: variant is never constructed: `bar3`
- --> $DIR/lint-dead-code-1.rs:67:5
- |
-LL | bar3
- | ^^^^
-
-error: function is never used: `priv_fn`
- --> $DIR/lint-dead-code-1.rs:88:1
- |
-LL | fn priv_fn() {
- | ^^^^^^^^^^^^
-
-error: function is never used: `foo`
- --> $DIR/lint-dead-code-1.rs:93:1
- |
-LL | fn foo() {
- | ^^^^^^^^
-
-error: function is never used: `bar`
- --> $DIR/lint-dead-code-1.rs:98:1
- |
-LL | fn bar() {
- | ^^^^^^^^
-
-error: function is never used: `baz`
- --> $DIR/lint-dead-code-1.rs:102:1
- |
-LL | fn baz() -> impl Copy {
- | ^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 10 previous errors
-
+++ /dev/null
-#![allow(unused_variables)]
-#![deny(dead_code)]
-#![feature(main, start)]
-
-struct Foo;
-
-trait Bar {
- fn bar1(&self);
- fn bar2(&self) {
- self.bar1();
- }
-}
-
-impl Bar for Foo {
- fn bar1(&self) {
- live_fn();
- }
-}
-
-fn live_fn() {}
-
-fn dead_fn() {} //~ ERROR: function is never used
-
-#[main]
-fn dead_fn2() {} //~ ERROR: function is never used
-
-fn used_fn() {}
-
-#[start]
-fn start(_: isize, _: *const *const u8) -> isize {
- used_fn();
- let foo = Foo;
- foo.bar2();
- 0
-}
-
-// this is not main
-fn main() { //~ ERROR: function is never used
- dead_fn();
- dead_fn2();
-}
+++ /dev/null
-error: function is never used: `dead_fn`
- --> $DIR/lint-dead-code-2.rs:22:1
- |
-LL | fn dead_fn() {}
- | ^^^^^^^^^^^^
- |
-note: lint level defined here
- --> $DIR/lint-dead-code-2.rs:2:9
- |
-LL | #![deny(dead_code)]
- | ^^^^^^^^^
-
-error: function is never used: `dead_fn2`
- --> $DIR/lint-dead-code-2.rs:25:1
- |
-LL | fn dead_fn2() {}
- | ^^^^^^^^^^^^^
-
-error: function is never used: `main`
- --> $DIR/lint-dead-code-2.rs:38:1
- |
-LL | fn main() {
- | ^^^^^^^^^
-
-error: aborting due to 3 previous errors
-
+++ /dev/null
-#![allow(unused_variables)]
-#![allow(non_camel_case_types)]
-#![deny(dead_code)]
-
-#![crate_type="lib"]
-
-
-pub use extern_foo as x;
-extern {
- pub fn extern_foo();
-}
-
-struct Foo; //~ ERROR: struct is never constructed
-impl Foo {
- fn foo(&self) { //~ ERROR: method is never used
- bar()
- }
-}
-
-fn bar() { //~ ERROR: function is never used
- fn baz() {}
-
- Foo.foo();
- baz();
-}
-
-// no warning
-struct Foo2;
-impl Foo2 { fn foo2(&self) { bar2() } }
-fn bar2() {
- fn baz2() {}
-
- Foo2.foo2();
- baz2();
-}
-
-pub fn pub_fn() {
- let foo2_struct = Foo2;
- foo2_struct.foo2();
-
- blah::baz();
-}
-
-mod blah {
- // not warned because it's used in the parameter of `free` and return of
- // `malloc` below, which are also used.
- enum c_void {}
-
- extern {
- fn free(p: *const c_void);
- fn malloc(size: usize) -> *const c_void;
- }
-
- pub fn baz() {
- unsafe { free(malloc(4)); }
- }
-}
-
-enum c_void {} //~ ERROR: enum is never used
-extern {
- fn free(p: *const c_void); //~ ERROR: foreign function is never used
-}
-
-// Check provided method
-mod inner {
- pub trait Trait {
- fn f(&self) { f(); }
- }
-
- impl Trait for isize {}
-
- fn f() {}
-}
-
-pub fn foo() {
- let a: &dyn inner::Trait = &1_isize;
- a.f();
-}
+++ /dev/null
-error: struct is never constructed: `Foo`
- --> $DIR/lint-dead-code-3.rs:13:1
- |
-LL | struct Foo;
- | ^^^^^^^^^^^
- |
-note: lint level defined here
- --> $DIR/lint-dead-code-3.rs:3:9
- |
-LL | #![deny(dead_code)]
- | ^^^^^^^^^
-
-error: method is never used: `foo`
- --> $DIR/lint-dead-code-3.rs:15:5
- |
-LL | fn foo(&self) {
- | ^^^^^^^^^^^^^
-
-error: function is never used: `bar`
- --> $DIR/lint-dead-code-3.rs:20:1
- |
-LL | fn bar() {
- | ^^^^^^^^
-
-error: enum is never used: `c_void`
- --> $DIR/lint-dead-code-3.rs:59:1
- |
-LL | enum c_void {}
- | ^^^^^^^^^^^
-
-error: foreign function is never used: `free`
- --> $DIR/lint-dead-code-3.rs:61:5
- |
-LL | fn free(p: *const c_void);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 5 previous errors
-
+++ /dev/null
-#![allow(unused_variables)]
-#![allow(non_camel_case_types)]
-#![deny(dead_code)]
-
-struct Foo {
- x: usize,
- b: bool, //~ ERROR: field is never used
-}
-
-fn field_read(f: Foo) -> usize {
- f.x.pow(2)
-}
-
-enum XYZ {
- X, //~ ERROR variant is never constructed
- Y { //~ ERROR variant is never constructed
- a: String,
- b: i32,
- c: i32,
- },
- Z
-}
-
-enum ABC { //~ ERROR enum is never used
- A,
- B {
- a: String,
- b: i32,
- c: i32,
- },
- C
-}
-
-// ensure struct variants get warning for their fields
-enum IJK {
- I, //~ ERROR variant is never constructed
- J {
- a: String,
- b: i32, //~ ERROR field is never used
- c: i32, //~ ERROR field is never used
- },
- K //~ ERROR variant is never constructed
-
-}
-
-fn struct_variant_partial_use(b: IJK) -> String {
- match b {
- IJK::J { a, b: _, .. } => a,
- _ => "".to_string()
- }
-}
-
-fn field_match_in_patterns(b: XYZ) -> String {
- match b {
- XYZ::Y { a, b: _, .. } => a,
- _ => "".to_string()
- }
-}
-
-struct Bar {
- x: usize, //~ ERROR: field is never used
- b: bool,
- c: bool, //~ ERROR: field is never used
- _guard: ()
-}
-
-#[repr(C)]
-struct Baz {
- x: u32,
-}
-
-fn field_match_in_let(f: Bar) -> bool {
- let Bar { b, c: _, .. } = f;
- b
-}
-
-fn main() {
- field_read(Foo { x: 1, b: false });
- field_match_in_patterns(XYZ::Z);
- struct_variant_partial_use(IJK::J { a: "".into(), b: 1, c: -1 });
- field_match_in_let(Bar { x: 42, b: true, c: false, _guard: () });
- let _ = Baz { x: 0 };
-}
+++ /dev/null
-error: field is never used: `b`
- --> $DIR/lint-dead-code-4.rs:7:5
- |
-LL | b: bool,
- | ^^^^^^^
- |
-note: lint level defined here
- --> $DIR/lint-dead-code-4.rs:3:9
- |
-LL | #![deny(dead_code)]
- | ^^^^^^^^^
-
-error: variant is never constructed: `X`
- --> $DIR/lint-dead-code-4.rs:15:5
- |
-LL | X,
- | ^
-
-error: variant is never constructed: `Y`
- --> $DIR/lint-dead-code-4.rs:16:5
- |
-LL | / Y {
-LL | | a: String,
-LL | | b: i32,
-LL | | c: i32,
-LL | | },
- | |_____^
-
-error: enum is never used: `ABC`
- --> $DIR/lint-dead-code-4.rs:24:1
- |
-LL | enum ABC {
- | ^^^^^^^^
-
-error: variant is never constructed: `I`
- --> $DIR/lint-dead-code-4.rs:36:5
- |
-LL | I,
- | ^
-
-error: field is never used: `b`
- --> $DIR/lint-dead-code-4.rs:39:9
- |
-LL | b: i32,
- | ^^^^^^
-
-error: field is never used: `c`
- --> $DIR/lint-dead-code-4.rs:40:9
- |
-LL | c: i32,
- | ^^^^^^
-
-error: variant is never constructed: `K`
- --> $DIR/lint-dead-code-4.rs:42:5
- |
-LL | K
- | ^
-
-error: field is never used: `x`
- --> $DIR/lint-dead-code-4.rs:61:5
- |
-LL | x: usize,
- | ^^^^^^^^
-
-error: field is never used: `c`
- --> $DIR/lint-dead-code-4.rs:63:5
- |
-LL | c: bool,
- | ^^^^^^^
-
-error: aborting due to 10 previous errors
-
+++ /dev/null
-#![allow(unused_variables)]
-#![deny(dead_code)]
-
-enum Enum1 {
- Variant1(isize),
- Variant2 //~ ERROR: variant is never constructed
-}
-
-enum Enum2 {
- Variant3(bool),
- #[allow(dead_code)]
- Variant4(isize),
- Variant5 { _x: isize }, //~ ERROR: variant is never constructed: `Variant5`
- Variant6(isize), //~ ERROR: variant is never constructed: `Variant6`
- _Variant7,
-}
-
-enum Enum3 { //~ ERROR: enum is never used
- Variant8,
- Variant9
-}
-
-fn main() {
- let v = Enum1::Variant1(1);
- match v {
- Enum1::Variant1(_) => (),
- Enum1::Variant2 => ()
- }
- let x = Enum2::Variant3(true);
-}
+++ /dev/null
-error: variant is never constructed: `Variant2`
- --> $DIR/lint-dead-code-5.rs:6:5
- |
-LL | Variant2
- | ^^^^^^^^
- |
-note: lint level defined here
- --> $DIR/lint-dead-code-5.rs:2:9
- |
-LL | #![deny(dead_code)]
- | ^^^^^^^^^
-
-error: variant is never constructed: `Variant5`
- --> $DIR/lint-dead-code-5.rs:13:5
- |
-LL | Variant5 { _x: isize },
- | ^^^^^^^^^^^^^^^^^^^^^^
-
-error: variant is never constructed: `Variant6`
- --> $DIR/lint-dead-code-5.rs:14:5
- |
-LL | Variant6(isize),
- | ^^^^^^^^^^^^^^^
-
-error: enum is never used: `Enum3`
- --> $DIR/lint-dead-code-5.rs:18:1
- |
-LL | enum Enum3 {
- | ^^^^^^^^^^
-
-error: aborting due to 4 previous errors
-
+++ /dev/null
-// check-pass
-
-#![deny(dead_code)]
-
-const TLC: usize = 4;
-
-trait Tr { fn doit(&self); }
-
-impl Tr for [usize; TLC] {
- fn doit(&self) {
- println!("called 4");
- }
-}
-
-struct X;
-struct Y;
-struct Z;
-
-trait Foo<T> {
- type Ty;
- fn foo() -> Self::Ty;
-}
-
-impl Foo<Y> for X {
- type Ty = Z;
- fn foo() -> Self::Ty {
- unimplemented!()
- }
-}
-
-fn main() {
- let s = [0,1,2,3];
- s.doit();
- X::foo();
-}
+++ /dev/null
-// build-pass
-#![deny(unused)]
-
-pub enum E {}
-
-fn main() {}
+++ /dev/null
-#![deny(unused)]
-
-enum E {} //~ ERROR enum is never used
-
-fn main() {}
+++ /dev/null
-error: enum is never used: `E`
- --> $DIR/lint-dead-code-empty-unused-enum.rs:3:1
- |
-LL | enum E {}
- | ^^^^^^
- |
-note: lint level defined here
- --> $DIR/lint-dead-code-empty-unused-enum.rs:1:9
- |
-LL | #![deny(unused)]
- | ^^^^^^
- = note: `#[deny(dead_code)]` implied by `#[deny(unused)]`
-
-error: aborting due to previous error
-
+++ /dev/null
-#![deny(dead_code)]
-
-trait Trait {
- type Type;
-}
-
-impl Trait for () {
- type Type = ();
-}
-
-type Used = ();
-type Unused = (); //~ ERROR type alias is never used
-
-fn foo() -> impl Trait<Type = Used> {}
-
-fn main() {
- foo();
-}
+++ /dev/null
-error: type alias is never used: `Unused`
- --> $DIR/lint-dead-code-impl-trait.rs:12:1
- |
-LL | type Unused = ();
- | ^^^^^^^^^^^^^^^^^
- |
-note: lint level defined here
- --> $DIR/lint-dead-code-impl-trait.rs:1:9
- |
-LL | #![deny(dead_code)]
- | ^^^^^^^^^
-
-error: aborting due to previous error
-
+++ /dev/null
-#![deny(dead_code)]
-
-type Used = u8;
-type Unused = u8; //~ ERROR type alias is never used
-
-fn id(x: Used) -> Used { x }
-
-fn main() {
- id(0);
-}
+++ /dev/null
-error: type alias is never used: `Unused`
- --> $DIR/lint-dead-code-type-alias.rs:4:1
- |
-LL | type Unused = u8;
- | ^^^^^^^^^^^^^^^^^
- |
-note: lint level defined here
- --> $DIR/lint-dead-code-type-alias.rs:1:9
- |
-LL | #![deny(dead_code)]
- | ^^^^^^^^^
-
-error: aborting due to previous error
-
+++ /dev/null
-#![deny(unused)]
-
-struct F; //~ ERROR struct is never constructed
-struct B; //~ ERROR struct is never constructed
-
-enum E { //~ ERROR enum is never used
- Foo(F),
- Bar(B),
-}
-
-fn main() {}
+++ /dev/null
-error: struct is never constructed: `F`
- --> $DIR/lint-dead-code-unused-enum.rs:3:1
- |
-LL | struct F;
- | ^^^^^^^^^
- |
-note: lint level defined here
- --> $DIR/lint-dead-code-unused-enum.rs:1:9
- |
-LL | #![deny(unused)]
- | ^^^^^^
- = note: `#[deny(dead_code)]` implied by `#[deny(unused)]`
-
-error: struct is never constructed: `B`
- --> $DIR/lint-dead-code-unused-enum.rs:4:1
- |
-LL | struct B;
- | ^^^^^^^^^
-
-error: enum is never used: `E`
- --> $DIR/lint-dead-code-unused-enum.rs:6:1
- |
-LL | enum E {
- | ^^^^^^
-
-error: aborting due to 3 previous errors
-
+++ /dev/null
-// build-pass
-#![deny(unused)]
-
-pub struct F;
-pub struct B;
-
-pub enum E {
- Foo(F),
- Bar(B),
-}
-
-fn main() {
- let _ = E::Foo(F);
-}
+++ /dev/null
-#![deny(unused)]
-
-struct F;
-struct B;
-
-enum E {
- Foo(F),
- Bar(B), //~ ERROR variant is never constructed
-}
-
-fn main() {
- let _ = E::Foo(F);
-}
+++ /dev/null
-error: variant is never constructed: `Bar`
- --> $DIR/lint-dead-code-unused-variant.rs:8:5
- |
-LL | Bar(B),
- | ^^^^^^
- |
-note: lint level defined here
- --> $DIR/lint-dead-code-unused-variant.rs:1:9
- |
-LL | #![deny(unused)]
- | ^^^^^^
- = note: `#[deny(dead_code)]` implied by `#[deny(unused)]`
-
-error: aborting due to previous error
-
+++ /dev/null
-#![deny(dead_code)]
-
-#[derive(Clone)]
-enum Enum {
- Variant1, //~ ERROR: variant is never constructed
- Variant2,
-}
-
-fn main() {
- let e = Enum::Variant2;
- e.clone();
-}
+++ /dev/null
-error: variant is never constructed: `Variant1`
- --> $DIR/lint-dead-code-variant.rs:5:5
- |
-LL | Variant1,
- | ^^^^^^^^
- |
-note: lint level defined here
- --> $DIR/lint-dead-code-variant.rs:1:9
- |
-LL | #![deny(dead_code)]
- | ^^^^^^^^^
-
-error: aborting due to previous error
-