From a4b7ed7a42c716ab9f05e351f003d589124fd55d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:58 +0200 Subject: Adding upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/lint/dead-code/alias-in-pat.rs | 10 -- src/test/ui/lint/dead-code/anon-const-in-pat.rs | 45 --------- src/test/ui/lint/dead-code/associated-type.rs | 19 ---- src/test/ui/lint/dead-code/basic.rs | 15 --- src/test/ui/lint/dead-code/basic.stderr | 14 --- src/test/ui/lint/dead-code/closure-bang.rs | 9 -- src/test/ui/lint/dead-code/const-and-self.rs | 54 ---------- src/test/ui/lint/dead-code/const-and-self.stderr | 19 ---- src/test/ui/lint/dead-code/empty-unused-enum.rs | 5 - .../ui/lint/dead-code/empty-unused-enum.stderr | 15 --- .../ui/lint/dead-code/empty-unused-public-enum.rs | 6 -- src/test/ui/lint/dead-code/enum-variants.rs | 14 --- src/test/ui/lint/dead-code/impl-trait.rs | 18 ---- src/test/ui/lint/dead-code/impl-trait.stderr | 14 --- .../lint/dead-code/issue-68408-false-positive.rs | 22 ----- src/test/ui/lint/dead-code/issue-85071-2.rs | 22 ----- src/test/ui/lint/dead-code/issue-85071-2.stderr | 34 ------- src/test/ui/lint/dead-code/issue-85071.rs | 19 ---- src/test/ui/lint/dead-code/issue-85071.stderr | 34 ------- src/test/ui/lint/dead-code/issue-85255.rs | 50 ---------- src/test/ui/lint/dead-code/issue-85255.stderr | 74 -------------- src/test/ui/lint/dead-code/leading-underscore.rs | 31 ------ src/test/ui/lint/dead-code/lint-dead-code-1.rs | 110 --------------------- src/test/ui/lint/dead-code/lint-dead-code-1.stderr | 71 ------------- src/test/ui/lint/dead-code/lint-dead-code-2.rs | 41 -------- src/test/ui/lint/dead-code/lint-dead-code-2.stderr | 26 ----- src/test/ui/lint/dead-code/lint-dead-code-3.rs | 90 ----------------- src/test/ui/lint/dead-code/lint-dead-code-3.stderr | 50 ---------- src/test/ui/lint/dead-code/lint-dead-code-4.rs | 83 ---------------- src/test/ui/lint/dead-code/lint-dead-code-4.stderr | 66 ------------- src/test/ui/lint/dead-code/lint-dead-code-5.rs | 50 ---------- src/test/ui/lint/dead-code/lint-dead-code-5.stderr | 34 ------- src/test/ui/lint/dead-code/lint-dead-code-6.rs | 20 ---- src/test/ui/lint/dead-code/lint-dead-code-6.stderr | 32 ------ .../multiple-dead-codes-in-the-same-struct.rs | 29 ------ .../multiple-dead-codes-in-the-same-struct.stderr | 55 ----------- src/test/ui/lint/dead-code/newline-span.rs | 19 ---- src/test/ui/lint/dead-code/newline-span.stderr | 26 ----- src/test/ui/lint/dead-code/self-assign.rs | 52 ---------- src/test/ui/lint/dead-code/self-assign.stderr | 44 --------- src/test/ui/lint/dead-code/trait-impl.rs | 19 ---- src/test/ui/lint/dead-code/tuple-struct-field.rs | 37 ------- .../ui/lint/dead-code/tuple-struct-field.stderr | 33 ------- src/test/ui/lint/dead-code/type-alias.rs | 10 -- src/test/ui/lint/dead-code/type-alias.stderr | 14 --- src/test/ui/lint/dead-code/type-in-foreign.rs | 19 ---- src/test/ui/lint/dead-code/unused-enum.rs | 12 --- src/test/ui/lint/dead-code/unused-enum.stderr | 27 ----- .../ui/lint/dead-code/unused-struct-variant.rs | 13 --- .../ui/lint/dead-code/unused-struct-variant.stderr | 18 ---- src/test/ui/lint/dead-code/unused-variant-pub.rs | 14 --- src/test/ui/lint/dead-code/unused-variant.rs | 12 --- src/test/ui/lint/dead-code/unused-variant.stderr | 17 ---- src/test/ui/lint/dead-code/with-core-crate.rs | 18 ---- src/test/ui/lint/dead-code/with-core-crate.stderr | 14 --- src/test/ui/lint/dead-code/with-impl.rs | 17 ---- 56 files changed, 1735 deletions(-) delete mode 100644 src/test/ui/lint/dead-code/alias-in-pat.rs delete mode 100644 src/test/ui/lint/dead-code/anon-const-in-pat.rs delete mode 100644 src/test/ui/lint/dead-code/associated-type.rs delete mode 100644 src/test/ui/lint/dead-code/basic.rs delete mode 100644 src/test/ui/lint/dead-code/basic.stderr delete mode 100644 src/test/ui/lint/dead-code/closure-bang.rs delete mode 100644 src/test/ui/lint/dead-code/const-and-self.rs delete mode 100644 src/test/ui/lint/dead-code/const-and-self.stderr delete mode 100644 src/test/ui/lint/dead-code/empty-unused-enum.rs delete mode 100644 src/test/ui/lint/dead-code/empty-unused-enum.stderr delete mode 100644 src/test/ui/lint/dead-code/empty-unused-public-enum.rs delete mode 100644 src/test/ui/lint/dead-code/enum-variants.rs delete mode 100644 src/test/ui/lint/dead-code/impl-trait.rs delete mode 100644 src/test/ui/lint/dead-code/impl-trait.stderr delete mode 100644 src/test/ui/lint/dead-code/issue-68408-false-positive.rs delete mode 100644 src/test/ui/lint/dead-code/issue-85071-2.rs delete mode 100644 src/test/ui/lint/dead-code/issue-85071-2.stderr delete mode 100644 src/test/ui/lint/dead-code/issue-85071.rs delete mode 100644 src/test/ui/lint/dead-code/issue-85071.stderr delete mode 100644 src/test/ui/lint/dead-code/issue-85255.rs delete mode 100644 src/test/ui/lint/dead-code/issue-85255.stderr delete mode 100644 src/test/ui/lint/dead-code/leading-underscore.rs delete mode 100644 src/test/ui/lint/dead-code/lint-dead-code-1.rs delete mode 100644 src/test/ui/lint/dead-code/lint-dead-code-1.stderr delete mode 100644 src/test/ui/lint/dead-code/lint-dead-code-2.rs delete mode 100644 src/test/ui/lint/dead-code/lint-dead-code-2.stderr delete mode 100644 src/test/ui/lint/dead-code/lint-dead-code-3.rs delete mode 100644 src/test/ui/lint/dead-code/lint-dead-code-3.stderr delete mode 100644 src/test/ui/lint/dead-code/lint-dead-code-4.rs delete mode 100644 src/test/ui/lint/dead-code/lint-dead-code-4.stderr delete mode 100644 src/test/ui/lint/dead-code/lint-dead-code-5.rs delete mode 100644 src/test/ui/lint/dead-code/lint-dead-code-5.stderr delete mode 100644 src/test/ui/lint/dead-code/lint-dead-code-6.rs delete mode 100644 src/test/ui/lint/dead-code/lint-dead-code-6.stderr delete mode 100644 src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.rs delete mode 100644 src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.stderr delete mode 100644 src/test/ui/lint/dead-code/newline-span.rs delete mode 100644 src/test/ui/lint/dead-code/newline-span.stderr delete mode 100644 src/test/ui/lint/dead-code/self-assign.rs delete mode 100644 src/test/ui/lint/dead-code/self-assign.stderr delete mode 100644 src/test/ui/lint/dead-code/trait-impl.rs delete mode 100644 src/test/ui/lint/dead-code/tuple-struct-field.rs delete mode 100644 src/test/ui/lint/dead-code/tuple-struct-field.stderr delete mode 100644 src/test/ui/lint/dead-code/type-alias.rs delete mode 100644 src/test/ui/lint/dead-code/type-alias.stderr delete mode 100644 src/test/ui/lint/dead-code/type-in-foreign.rs delete mode 100644 src/test/ui/lint/dead-code/unused-enum.rs delete mode 100644 src/test/ui/lint/dead-code/unused-enum.stderr delete mode 100644 src/test/ui/lint/dead-code/unused-struct-variant.rs delete mode 100644 src/test/ui/lint/dead-code/unused-struct-variant.stderr delete mode 100644 src/test/ui/lint/dead-code/unused-variant-pub.rs delete mode 100644 src/test/ui/lint/dead-code/unused-variant.rs delete mode 100644 src/test/ui/lint/dead-code/unused-variant.stderr delete mode 100644 src/test/ui/lint/dead-code/with-core-crate.rs delete mode 100644 src/test/ui/lint/dead-code/with-core-crate.stderr delete mode 100644 src/test/ui/lint/dead-code/with-impl.rs (limited to 'src/test/ui/lint/dead-code') diff --git a/src/test/ui/lint/dead-code/alias-in-pat.rs b/src/test/ui/lint/dead-code/alias-in-pat.rs deleted file mode 100644 index 69d455f3b..000000000 --- a/src/test/ui/lint/dead-code/alias-in-pat.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass - -#![deny(dead_code)] - -fn main() { - struct Foo { x: T } - type Bar = Foo; - let spam = |Bar { x }| x != 0; - println!("{}", spam(Foo { x: 10 })); -} diff --git a/src/test/ui/lint/dead-code/anon-const-in-pat.rs b/src/test/ui/lint/dead-code/anon-const-in-pat.rs deleted file mode 100644 index d3e39c0de..000000000 --- a/src/test/ui/lint/dead-code/anon-const-in-pat.rs +++ /dev/null @@ -1,45 +0,0 @@ -// check-pass -#![feature(inline_const_pat)] -#![allow(incomplete_features)] -#![deny(dead_code)] - -const fn one() -> i32 { - 1 -} - -const fn two() -> i32 { - 2 -} - -const fn three() -> i32 { - 3 -} - -fn inline_const() { - // rust-lang/rust#78171: dead_code lint triggers even though function is used in const pattern - match 1 { - const { one() } => {} - _ => {} - } -} - -fn inline_const_range() { - match 1 { - 1 ..= const { two() } => {} - _ => {} - } -} - -struct S; - -fn const_generic_arg() { - match S::<3> { - S::<{three()}> => {} - } -} - -fn main() { - inline_const(); - inline_const_range(); - const_generic_arg(); -} diff --git a/src/test/ui/lint/dead-code/associated-type.rs b/src/test/ui/lint/dead-code/associated-type.rs deleted file mode 100644 index 1cf66e75a..000000000 --- a/src/test/ui/lint/dead-code/associated-type.rs +++ /dev/null @@ -1,19 +0,0 @@ -// 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; -} diff --git a/src/test/ui/lint/dead-code/basic.rs b/src/test/ui/lint/dead-code/basic.rs deleted file mode 100644 index 3b8ffd58c..000000000 --- a/src/test/ui/lint/dead-code/basic.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![deny(dead_code)] -#![allow(unreachable_code)] - -fn foo() { //~ ERROR function `foo` is never used - - // none of these should have any dead_code exposed to the user - panic!(); - - panic!("foo"); - - panic!("bar {}", "baz") -} - - -fn main() {} diff --git a/src/test/ui/lint/dead-code/basic.stderr b/src/test/ui/lint/dead-code/basic.stderr deleted file mode 100644 index 7d068cead..000000000 --- a/src/test/ui/lint/dead-code/basic.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: function `foo` is never used - --> $DIR/basic.rs:4:4 - | -LL | fn foo() { - | ^^^ - | -note: the lint level is defined here - --> $DIR/basic.rs:1:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/lint/dead-code/closure-bang.rs b/src/test/ui/lint/dead-code/closure-bang.rs deleted file mode 100644 index 8e8636b11..000000000 --- a/src/test/ui/lint/dead-code/closure-bang.rs +++ /dev/null @@ -1,9 +0,0 @@ -// ignore-test FIXME(#20574) - -#![deny(unreachable_code)] - -fn main() { - let x = || panic!(); - x(); - println!("Foo bar"); //~ ERROR: unreachable statement -} diff --git a/src/test/ui/lint/dead-code/const-and-self.rs b/src/test/ui/lint/dead-code/const-and-self.rs deleted file mode 100644 index 5c96e4d0e..000000000 --- a/src/test/ui/lint/dead-code/const-and-self.rs +++ /dev/null @@ -1,54 +0,0 @@ -// check-pass - -#![warn(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 { - type Ty; - fn foo() -> Self::Ty; -} - -impl Foo for X { - type Ty = Z; - fn foo() -> Self::Ty { - unimplemented!() - } -} - -enum E { - A, - B, //~ WARN variants `B` and `C` are never constructed - C, -} - -type F = E; - -impl E { - fn check(&self) -> bool { - match self { - Self::A => true, - Self::B => false, - F::C => false, - } - } -} - -fn main() { - let s = [0,1,2,3]; - s.doit(); - X::foo(); - E::A.check(); -} diff --git a/src/test/ui/lint/dead-code/const-and-self.stderr b/src/test/ui/lint/dead-code/const-and-self.stderr deleted file mode 100644 index 9d1d7d6ec..000000000 --- a/src/test/ui/lint/dead-code/const-and-self.stderr +++ /dev/null @@ -1,19 +0,0 @@ -warning: variants `B` and `C` are never constructed - --> $DIR/const-and-self.rs:33:5 - | -LL | enum E { - | - variants in this enum -LL | A, -LL | B, - | ^ -LL | C, - | ^ - | -note: the lint level is defined here - --> $DIR/const-and-self.rs:3:9 - | -LL | #![warn(dead_code)] - | ^^^^^^^^^ - -warning: 1 warning emitted - diff --git a/src/test/ui/lint/dead-code/empty-unused-enum.rs b/src/test/ui/lint/dead-code/empty-unused-enum.rs deleted file mode 100644 index 864501e94..000000000 --- a/src/test/ui/lint/dead-code/empty-unused-enum.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![deny(unused)] - -enum E {} //~ ERROR enum `E` is never used - -fn main() {} diff --git a/src/test/ui/lint/dead-code/empty-unused-enum.stderr b/src/test/ui/lint/dead-code/empty-unused-enum.stderr deleted file mode 100644 index 6391f0941..000000000 --- a/src/test/ui/lint/dead-code/empty-unused-enum.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error: enum `E` is never used - --> $DIR/empty-unused-enum.rs:3:6 - | -LL | enum E {} - | ^ - | -note: the lint level is 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 - diff --git a/src/test/ui/lint/dead-code/empty-unused-public-enum.rs b/src/test/ui/lint/dead-code/empty-unused-public-enum.rs deleted file mode 100644 index 15b04496b..000000000 --- a/src/test/ui/lint/dead-code/empty-unused-public-enum.rs +++ /dev/null @@ -1,6 +0,0 @@ -// build-pass -#![deny(unused)] - -pub enum E {} - -fn main() {} diff --git a/src/test/ui/lint/dead-code/enum-variants.rs b/src/test/ui/lint/dead-code/enum-variants.rs deleted file mode 100644 index 91c97232e..000000000 --- a/src/test/ui/lint/dead-code/enum-variants.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass - -#![deny(dead_code)] - -enum Foo { - A, - B, -} - -pub fn main() { - match Foo::A { - Foo::A | Foo::B => Foo::B - }; -} diff --git a/src/test/ui/lint/dead-code/impl-trait.rs b/src/test/ui/lint/dead-code/impl-trait.rs deleted file mode 100644 index 757b8f83e..000000000 --- a/src/test/ui/lint/dead-code/impl-trait.rs +++ /dev/null @@ -1,18 +0,0 @@ -#![deny(dead_code)] - -trait Trait { - type Type; -} - -impl Trait for () { - type Type = (); -} - -type Used = (); -type Unused = (); //~ ERROR type alias `Unused` is never used - -fn foo() -> impl Trait {} - -fn main() { - foo(); -} diff --git a/src/test/ui/lint/dead-code/impl-trait.stderr b/src/test/ui/lint/dead-code/impl-trait.stderr deleted file mode 100644 index e35e13a9e..000000000 --- a/src/test/ui/lint/dead-code/impl-trait.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: type alias `Unused` is never used - --> $DIR/impl-trait.rs:12:6 - | -LL | type Unused = (); - | ^^^^^^ - | -note: the lint level is defined here - --> $DIR/impl-trait.rs:1:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/lint/dead-code/issue-68408-false-positive.rs b/src/test/ui/lint/dead-code/issue-68408-false-positive.rs deleted file mode 100644 index 7ee6b5d72..000000000 --- a/src/test/ui/lint/dead-code/issue-68408-false-positive.rs +++ /dev/null @@ -1,22 +0,0 @@ -// check-pass - -// Make sure we don't have any false positives here. - -#![deny(dead_code)] - -enum X { - A { _a: () }, - B { _b: () }, -} -impl X { - fn a() -> X { - X::A { _a: () } - } - fn b() -> Self { - Self::B { _b: () } - } -} - -fn main() { - let (_, _) = (X::a(), X::b()); -} diff --git a/src/test/ui/lint/dead-code/issue-85071-2.rs b/src/test/ui/lint/dead-code/issue-85071-2.rs deleted file mode 100644 index f0639931c..000000000 --- a/src/test/ui/lint/dead-code/issue-85071-2.rs +++ /dev/null @@ -1,22 +0,0 @@ -// A slight variation of issue-85071.rs. Here, a method is called instead -// of a function, and the warning is about an unreachable definition -// instead of an unreachable expression. - -// check-pass - -#![warn(unused_variables,unreachable_code)] - -enum Foo {} - -struct S; -impl S { - fn f(&self) -> Foo {todo!()} -} - -fn main() { - let s = S; - let x = s.f(); - //~^ WARNING: unused variable: `x` - let _y = x; - //~^ WARNING: unreachable definition -} diff --git a/src/test/ui/lint/dead-code/issue-85071-2.stderr b/src/test/ui/lint/dead-code/issue-85071-2.stderr deleted file mode 100644 index 5e963183d..000000000 --- a/src/test/ui/lint/dead-code/issue-85071-2.stderr +++ /dev/null @@ -1,34 +0,0 @@ -warning: unreachable definition - --> $DIR/issue-85071-2.rs:20:9 - | -LL | let x = s.f(); - | ----- any code following this expression is unreachable -LL | -LL | let _y = x; - | ^^ unreachable definition - | -note: this expression has type `Foo`, which is uninhabited - --> $DIR/issue-85071-2.rs:18:13 - | -LL | let x = s.f(); - | ^^^^^ -note: the lint level is defined here - --> $DIR/issue-85071-2.rs:7:26 - | -LL | #![warn(unused_variables,unreachable_code)] - | ^^^^^^^^^^^^^^^^ - -warning: unused variable: `x` - --> $DIR/issue-85071-2.rs:18:9 - | -LL | let x = s.f(); - | ^ help: if this is intentional, prefix it with an underscore: `_x` - | -note: the lint level is defined here - --> $DIR/issue-85071-2.rs:7:9 - | -LL | #![warn(unused_variables,unreachable_code)] - | ^^^^^^^^^^^^^^^^ - -warning: 2 warnings emitted - diff --git a/src/test/ui/lint/dead-code/issue-85071.rs b/src/test/ui/lint/dead-code/issue-85071.rs deleted file mode 100644 index d6969321c..000000000 --- a/src/test/ui/lint/dead-code/issue-85071.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Checks that an unreachable code warning is emitted when an expression is -// preceded by an expression with an uninhabited type. Previously, the -// variable liveness analysis was "smarter" than the reachability analysis -// in this regard, which led to confusing "unused variable" warnings -// without an accompanying explanatory "unreachable expression" warning. - -// check-pass - -#![warn(unused_variables,unreachable_code)] - -enum Foo {} -fn f() -> Foo {todo!()} - -fn main() { - let x = f(); - //~^ WARNING: unused variable: `x` - let _ = x; - //~^ WARNING: unreachable expression -} diff --git a/src/test/ui/lint/dead-code/issue-85071.stderr b/src/test/ui/lint/dead-code/issue-85071.stderr deleted file mode 100644 index 721fb8148..000000000 --- a/src/test/ui/lint/dead-code/issue-85071.stderr +++ /dev/null @@ -1,34 +0,0 @@ -warning: unreachable expression - --> $DIR/issue-85071.rs:17:13 - | -LL | let x = f(); - | --- any code following this expression is unreachable -LL | -LL | let _ = x; - | ^ unreachable expression - | -note: this expression has type `Foo`, which is uninhabited - --> $DIR/issue-85071.rs:15:13 - | -LL | let x = f(); - | ^^^ -note: the lint level is defined here - --> $DIR/issue-85071.rs:9:26 - | -LL | #![warn(unused_variables,unreachable_code)] - | ^^^^^^^^^^^^^^^^ - -warning: unused variable: `x` - --> $DIR/issue-85071.rs:15:9 - | -LL | let x = f(); - | ^ help: if this is intentional, prefix it with an underscore: `_x` - | -note: the lint level is defined here - --> $DIR/issue-85071.rs:9:9 - | -LL | #![warn(unused_variables,unreachable_code)] - | ^^^^^^^^^^^^^^^^ - -warning: 2 warnings emitted - diff --git a/src/test/ui/lint/dead-code/issue-85255.rs b/src/test/ui/lint/dead-code/issue-85255.rs deleted file mode 100644 index 043f68137..000000000 --- a/src/test/ui/lint/dead-code/issue-85255.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Unused `pub` fields in non-`pub` structs should also trigger dead code warnings. -// check-pass - -#![warn(dead_code)] - -struct Foo { - a: i32, //~ WARNING: fields `a` and `b` are never read - pub b: i32, -} - -struct Bar; - -impl Bar { - fn a(&self) -> i32 { 5 } //~ WARNING: associated function `a` is never used - pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function `b` is never used -} - -pub(crate) struct Foo1 { - a: i32, //~ WARNING: fields `a` and `b` are never read - pub b: i32, -} - -pub(crate) struct Bar1; - -impl Bar1 { - fn a(&self) -> i32 { 5 } //~ WARNING: associated function `a` is never used - pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function `b` is never used -} - -pub(crate) struct Foo2 { - a: i32, //~ WARNING: fields `a` and `b` are never read - pub b: i32, -} - -pub(crate) struct Bar2; - -impl Bar2 { - fn a(&self) -> i32 { 5 } //~ WARNING: associated function `a` is never used - pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function `b` is never used -} - - -fn main() { - let _ = Foo { a: 1, b: 2 }; - let _ = Bar; - let _ = Foo1 { a: 1, b: 2 }; - let _ = Bar1; - let _ = Foo2 { a: 1, b: 2 }; - let _ = Bar2; -} diff --git a/src/test/ui/lint/dead-code/issue-85255.stderr b/src/test/ui/lint/dead-code/issue-85255.stderr deleted file mode 100644 index 3497b952f..000000000 --- a/src/test/ui/lint/dead-code/issue-85255.stderr +++ /dev/null @@ -1,74 +0,0 @@ -warning: fields `a` and `b` are never read - --> $DIR/issue-85255.rs:7:5 - | -LL | struct Foo { - | --- fields in this struct -LL | a: i32, - | ^ -LL | pub b: i32, - | ^ - | -note: the lint level is defined here - --> $DIR/issue-85255.rs:4:9 - | -LL | #![warn(dead_code)] - | ^^^^^^^^^ - -warning: fields `a` and `b` are never read - --> $DIR/issue-85255.rs:19:5 - | -LL | pub(crate) struct Foo1 { - | ---- fields in this struct -LL | a: i32, - | ^ -LL | pub b: i32, - | ^ - -warning: fields `a` and `b` are never read - --> $DIR/issue-85255.rs:31:5 - | -LL | pub(crate) struct Foo2 { - | ---- fields in this struct -LL | a: i32, - | ^ -LL | pub b: i32, - | ^ - -warning: associated function `a` is never used - --> $DIR/issue-85255.rs:14:8 - | -LL | fn a(&self) -> i32 { 5 } - | ^ - -warning: associated function `b` is never used - --> $DIR/issue-85255.rs:15:12 - | -LL | pub fn b(&self) -> i32 { 6 } - | ^ - -warning: associated function `a` is never used - --> $DIR/issue-85255.rs:26:8 - | -LL | fn a(&self) -> i32 { 5 } - | ^ - -warning: associated function `b` is never used - --> $DIR/issue-85255.rs:27:12 - | -LL | pub fn b(&self) -> i32 { 6 } - | ^ - -warning: associated function `a` is never used - --> $DIR/issue-85255.rs:38:8 - | -LL | fn a(&self) -> i32 { 5 } - | ^ - -warning: associated function `b` is never used - --> $DIR/issue-85255.rs:39:12 - | -LL | pub fn b(&self) -> i32 { 6 } - | ^ - -warning: 9 warnings emitted - diff --git a/src/test/ui/lint/dead-code/leading-underscore.rs b/src/test/ui/lint/dead-code/leading-underscore.rs deleted file mode 100644 index d3582961b..000000000 --- a/src/test/ui/lint/dead-code/leading-underscore.rs +++ /dev/null @@ -1,31 +0,0 @@ -// 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 "C" { - #[link_name = "abort"] - fn _abort() -> !; -} - -pub fn main() {} diff --git a/src/test/ui/lint/dead-code/lint-dead-code-1.rs b/src/test/ui/lint/dead-code/lint-dead-code-1.rs deleted file mode 100644 index 8f5a4c41e..000000000 --- a/src/test/ui/lint/dead-code/lint-dead-code-1.rs +++ /dev/null @@ -1,110 +0,0 @@ -#![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 `Bar` is never constructed -} - -mod foo2 { - pub struct Bar2; -} - -pub static pub_static: isize = 0; -static priv_static: isize = 0; //~ ERROR: static `priv_static` 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 `priv_const` 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 `PrivStruct` 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 `priv_enum` is never used -enum used_enum { - foo3, - bar3 //~ ERROR variant `bar3` is never constructed -} - -fn f() {} - -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::(); -} -fn priv_fn() { //~ ERROR: function `priv_fn` is never used - let unused_struct = PrivStruct; -} -fn used_fn() {} - -fn foo() { //~ ERROR: function `foo` is never used - bar(); - let unused_enum = priv_enum::foo2; -} - -fn bar() { //~ ERROR: function `bar` is never used - foo(); -} - -fn baz() -> impl Copy { //~ ERROR: function `baz` 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() {} diff --git a/src/test/ui/lint/dead-code/lint-dead-code-1.stderr b/src/test/ui/lint/dead-code/lint-dead-code-1.stderr deleted file mode 100644 index eb728b5b9..000000000 --- a/src/test/ui/lint/dead-code/lint-dead-code-1.stderr +++ /dev/null @@ -1,71 +0,0 @@ -error: static `priv_static` is never used - --> $DIR/lint-dead-code-1.rs:20:8 - | -LL | static priv_static: isize = 0; - | ^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/lint-dead-code-1.rs:5:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: constant `priv_const` is never used - --> $DIR/lint-dead-code-1.rs:27:7 - | -LL | const priv_const: isize = 0; - | ^^^^^^^^^^ - -error: struct `PrivStruct` is never constructed - --> $DIR/lint-dead-code-1.rs:35:8 - | -LL | struct PrivStruct; - | ^^^^^^^^^^ - -error: enum `priv_enum` is never used - --> $DIR/lint-dead-code-1.rs:64:6 - | -LL | enum priv_enum { foo2, bar2 } - | ^^^^^^^^^ - -error: variant `bar3` is never constructed - --> $DIR/lint-dead-code-1.rs:67:5 - | -LL | enum used_enum { - | --------- variant in this enum -LL | foo3, -LL | bar3 - | ^^^^ - -error: function `priv_fn` is never used - --> $DIR/lint-dead-code-1.rs:88:4 - | -LL | fn priv_fn() { - | ^^^^^^^ - -error: function `foo` is never used - --> $DIR/lint-dead-code-1.rs:93:4 - | -LL | fn foo() { - | ^^^ - -error: function `bar` is never used - --> $DIR/lint-dead-code-1.rs:98:4 - | -LL | fn bar() { - | ^^^ - -error: function `baz` is never used - --> $DIR/lint-dead-code-1.rs:102:4 - | -LL | fn baz() -> impl Copy { - | ^^^ - -error: struct `Bar` is never constructed - --> $DIR/lint-dead-code-1.rs:12:16 - | -LL | pub struct Bar; - | ^^^ - -error: aborting due to 10 previous errors - diff --git a/src/test/ui/lint/dead-code/lint-dead-code-2.rs b/src/test/ui/lint/dead-code/lint-dead-code-2.rs deleted file mode 100644 index 6bfa4d96f..000000000 --- a/src/test/ui/lint/dead-code/lint-dead-code-2.rs +++ /dev/null @@ -1,41 +0,0 @@ -#![allow(unused_variables)] -#![deny(dead_code)] -#![feature(rustc_attrs, 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 `dead_fn` is never used - -#[rustc_main] -fn dead_fn2() {} //~ ERROR: function `dead_fn2` 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 `main` is never used - dead_fn(); - dead_fn2(); -} diff --git a/src/test/ui/lint/dead-code/lint-dead-code-2.stderr b/src/test/ui/lint/dead-code/lint-dead-code-2.stderr deleted file mode 100644 index 85af553c9..000000000 --- a/src/test/ui/lint/dead-code/lint-dead-code-2.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: function `dead_fn` is never used - --> $DIR/lint-dead-code-2.rs:22:4 - | -LL | fn dead_fn() {} - | ^^^^^^^ - | -note: the lint level is defined here - --> $DIR/lint-dead-code-2.rs:2:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: function `dead_fn2` is never used - --> $DIR/lint-dead-code-2.rs:25:4 - | -LL | fn dead_fn2() {} - | ^^^^^^^^ - -error: function `main` is never used - --> $DIR/lint-dead-code-2.rs:38:4 - | -LL | fn main() { - | ^^^^ - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/lint/dead-code/lint-dead-code-3.rs b/src/test/ui/lint/dead-code/lint-dead-code-3.rs deleted file mode 100644 index 293fcdbc5..000000000 --- a/src/test/ui/lint/dead-code/lint-dead-code-3.rs +++ /dev/null @@ -1,90 +0,0 @@ -#![allow(unused_variables)] -#![allow(non_camel_case_types)] -#![allow(clashing_extern_declarations)] -#![deny(dead_code)] - -#![crate_type="lib"] - - -pub use extern_foo as x; -extern "C" { - pub fn extern_foo(); -} - -struct Foo; //~ ERROR: struct `Foo` is never constructed -impl Foo { - fn foo(&self) { //~ ERROR: associated function `foo` is never used - bar() - } -} - -fn bar() { //~ ERROR: function `bar` 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 "C" { - 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 `c_void` is never used -extern "C" { - fn free(p: *const c_void); //~ ERROR: function `free` is never used -} - -// Check provided method -mod inner { - pub trait Trait { - fn f(&self) { f(); } - } - - impl Trait for isize {} - - fn f() {} -} - -fn anon_const() -> [(); { - fn blah() {} //~ ERROR: function `blah` is never used - 1 -}] { - [(); { - fn blah() {} //~ ERROR: function `blah` is never used - 1 - }] -} - -pub fn foo() { - let a: &dyn inner::Trait = &1_isize; - a.f(); - anon_const(); -} diff --git a/src/test/ui/lint/dead-code/lint-dead-code-3.stderr b/src/test/ui/lint/dead-code/lint-dead-code-3.stderr deleted file mode 100644 index 26fc13bae..000000000 --- a/src/test/ui/lint/dead-code/lint-dead-code-3.stderr +++ /dev/null @@ -1,50 +0,0 @@ -error: struct `Foo` is never constructed - --> $DIR/lint-dead-code-3.rs:14:8 - | -LL | struct Foo; - | ^^^ - | -note: the lint level is defined here - --> $DIR/lint-dead-code-3.rs:4:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: function `bar` is never used - --> $DIR/lint-dead-code-3.rs:21:4 - | -LL | fn bar() { - | ^^^ - -error: enum `c_void` is never used - --> $DIR/lint-dead-code-3.rs:60:6 - | -LL | enum c_void {} - | ^^^^^^ - -error: function `blah` is never used - --> $DIR/lint-dead-code-3.rs:77:8 - | -LL | fn blah() {} - | ^^^^ - -error: function `blah` is never used - --> $DIR/lint-dead-code-3.rs:81:12 - | -LL | fn blah() {} - | ^^^^ - -error: associated function `foo` is never used - --> $DIR/lint-dead-code-3.rs:16:8 - | -LL | fn foo(&self) { - | ^^^ - -error: function `free` is never used - --> $DIR/lint-dead-code-3.rs:62:8 - | -LL | fn free(p: *const c_void); - | ^^^^ - -error: aborting due to 7 previous errors - diff --git a/src/test/ui/lint/dead-code/lint-dead-code-4.rs b/src/test/ui/lint/dead-code/lint-dead-code-4.rs deleted file mode 100644 index 0fc6c6156..000000000 --- a/src/test/ui/lint/dead-code/lint-dead-code-4.rs +++ /dev/null @@ -1,83 +0,0 @@ -#![allow(unused_variables)] -#![allow(non_camel_case_types)] -#![deny(dead_code)] - -struct Foo { - x: usize, - b: bool, //~ ERROR: field `b` is never read -} - -fn field_read(f: Foo) -> usize { - f.x.pow(2) -} - -enum XYZ { - X, //~ ERROR variants `X` and `Y` are never constructed - Y { - a: String, - b: i32, - c: i32, - }, - Z -} - -enum ABC { //~ ERROR enum `ABC` is never used - A, - B { - a: String, - b: i32, - c: i32, - }, - C -} - -// ensure struct variants get warning for their fields -enum IJK { - I, //~ ERROR variants `I` and `K` are never constructed - J { - a: String, - b: i32, //~ ERROR fields `b` and `c` are never read - c: i32, - }, - K - -} - -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: fields `x` and `c` are never read - b: bool, - c: bool, - _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 }; -} diff --git a/src/test/ui/lint/dead-code/lint-dead-code-4.stderr b/src/test/ui/lint/dead-code/lint-dead-code-4.stderr deleted file mode 100644 index 668c1dacf..000000000 --- a/src/test/ui/lint/dead-code/lint-dead-code-4.stderr +++ /dev/null @@ -1,66 +0,0 @@ -error: field `b` is never read - --> $DIR/lint-dead-code-4.rs:7:5 - | -LL | struct Foo { - | --- field in this struct -LL | x: usize, -LL | b: bool, - | ^ - | -note: the lint level is defined here - --> $DIR/lint-dead-code-4.rs:3:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: variants `X` and `Y` are never constructed - --> $DIR/lint-dead-code-4.rs:15:5 - | -LL | enum XYZ { - | --- variants in this enum -LL | X, - | ^ -LL | Y { - | ^ - -error: enum `ABC` is never used - --> $DIR/lint-dead-code-4.rs:24:6 - | -LL | enum ABC { - | ^^^ - -error: fields `b` and `c` are never read - --> $DIR/lint-dead-code-4.rs:39:9 - | -LL | J { - | - fields in this variant -LL | a: String, -LL | b: i32, - | ^ -LL | c: i32, - | ^ - -error: variants `I` and `K` are never constructed - --> $DIR/lint-dead-code-4.rs:36:5 - | -LL | enum IJK { - | --- variants in this enum -LL | I, - | ^ -... -LL | K - | ^ - -error: fields `x` and `c` are never read - --> $DIR/lint-dead-code-4.rs:61:5 - | -LL | struct Bar { - | --- fields in this struct -LL | x: usize, - | ^ -LL | b: bool, -LL | c: bool, - | ^ - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/lint/dead-code/lint-dead-code-5.rs b/src/test/ui/lint/dead-code/lint-dead-code-5.rs deleted file mode 100644 index ed90fb464..000000000 --- a/src/test/ui/lint/dead-code/lint-dead-code-5.rs +++ /dev/null @@ -1,50 +0,0 @@ -#![allow(unused_variables)] -#![deny(dead_code)] - -enum Enum1 { - Variant1(isize), - Variant2 //~ ERROR: variant `Variant2` is never constructed -} - -enum Enum2 { - Variant3(bool), - #[allow(dead_code)] - Variant4(isize), - Variant5 { _x: isize }, //~ ERROR: variants `Variant5` and `Variant6` are never constructed - Variant6(isize), - _Variant7, - Variant8 { _field: bool }, - Variant9, - Variant10(usize) -} - -impl Enum2 { - fn new_variant8() -> Enum2 { - Self::Variant8 { _field: true } - } - - fn new_variant9() -> Enum2 { - Self::Variant9 - } - - fn new_variant10() -> Enum2 { - Self::Variant10(10) - } -} - -enum Enum3 { //~ ERROR: enum `Enum3` is never used - Variant8, - Variant9 -} - -fn main() { - let v = Enum1::Variant1(1); - match v { - Enum1::Variant1(_) => (), - Enum1::Variant2 => () - } - let x = Enum2::Variant3(true); - let _ = Enum2::new_variant8(); - let _ = Enum2::new_variant9(); - let _ = Enum2::new_variant10(); -} diff --git a/src/test/ui/lint/dead-code/lint-dead-code-5.stderr b/src/test/ui/lint/dead-code/lint-dead-code-5.stderr deleted file mode 100644 index eaf43e453..000000000 --- a/src/test/ui/lint/dead-code/lint-dead-code-5.stderr +++ /dev/null @@ -1,34 +0,0 @@ -error: variant `Variant2` is never constructed - --> $DIR/lint-dead-code-5.rs:6:5 - | -LL | enum Enum1 { - | ----- variant in this enum -LL | Variant1(isize), -LL | Variant2 - | ^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/lint-dead-code-5.rs:2:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: variants `Variant5` and `Variant6` are never constructed - --> $DIR/lint-dead-code-5.rs:13:5 - | -LL | enum Enum2 { - | ----- variants in this enum -... -LL | Variant5 { _x: isize }, - | ^^^^^^^^ -LL | Variant6(isize), - | ^^^^^^^^ - -error: enum `Enum3` is never used - --> $DIR/lint-dead-code-5.rs:35:6 - | -LL | enum Enum3 { - | ^^^^^ - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/lint/dead-code/lint-dead-code-6.rs b/src/test/ui/lint/dead-code/lint-dead-code-6.rs deleted file mode 100644 index e3074acf1..000000000 --- a/src/test/ui/lint/dead-code/lint-dead-code-6.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![deny(dead_code)] - -struct UnusedStruct; //~ ERROR struct `UnusedStruct` is never constructed -impl UnusedStruct { - fn unused_impl_fn_1() { //~ ERROR associated function `unused_impl_fn_1` is never used - println!("blah"); - } - - fn unused_impl_fn_2(var: i32) { //~ ERROR associated function `unused_impl_fn_2` is never used - println!("foo {}", var); - } - - fn unused_impl_fn_3( //~ ERROR associated function `unused_impl_fn_3` is never used - var: i32, - ) { - println!("bar {}", var); - } -} - -fn main() {} diff --git a/src/test/ui/lint/dead-code/lint-dead-code-6.stderr b/src/test/ui/lint/dead-code/lint-dead-code-6.stderr deleted file mode 100644 index f9d83308a..000000000 --- a/src/test/ui/lint/dead-code/lint-dead-code-6.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error: struct `UnusedStruct` is never constructed - --> $DIR/lint-dead-code-6.rs:3:8 - | -LL | struct UnusedStruct; - | ^^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/lint-dead-code-6.rs:1:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: associated function `unused_impl_fn_1` is never used - --> $DIR/lint-dead-code-6.rs:5:8 - | -LL | fn unused_impl_fn_1() { - | ^^^^^^^^^^^^^^^^ - -error: associated function `unused_impl_fn_2` is never used - --> $DIR/lint-dead-code-6.rs:9:8 - | -LL | fn unused_impl_fn_2(var: i32) { - | ^^^^^^^^^^^^^^^^ - -error: associated function `unused_impl_fn_3` is never used - --> $DIR/lint-dead-code-6.rs:13:8 - | -LL | fn unused_impl_fn_3( - | ^^^^^^^^^^^^^^^^ - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.rs b/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.rs deleted file mode 100644 index 2003e1e29..000000000 --- a/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.rs +++ /dev/null @@ -1,29 +0,0 @@ -#![warn(dead_code)] - -struct Bar { - #[allow(dead_code)] - a: usize, - #[forbid(dead_code)] - b: usize, //~ ERROR field `b` is never read - #[deny(dead_code)] - c: usize, //~ ERROR fields `c` and `e` are never read - d: usize, //~ WARN fields `d`, `f`, and `g` are never read - #[deny(dead_code)] - e: usize, - f: usize, - g: usize, - _h: usize, -} - -fn main() { - Bar { - a: 1, - b: 1, - c: 1, - d: 1, - e: 1, - f: 1, - g: 1, - _h: 1, - }; -} diff --git a/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.stderr b/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.stderr deleted file mode 100644 index 0e5c78a71..000000000 --- a/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.stderr +++ /dev/null @@ -1,55 +0,0 @@ -warning: fields `d`, `f`, and `g` are never read - --> $DIR/multiple-dead-codes-in-the-same-struct.rs:10:5 - | -LL | struct Bar { - | --- fields in this struct -... -LL | d: usize, - | ^ -... -LL | f: usize, - | ^ -LL | g: usize, - | ^ - | -note: the lint level is defined here - --> $DIR/multiple-dead-codes-in-the-same-struct.rs:1:9 - | -LL | #![warn(dead_code)] - | ^^^^^^^^^ - -error: fields `c` and `e` are never read - --> $DIR/multiple-dead-codes-in-the-same-struct.rs:9:5 - | -LL | struct Bar { - | --- fields in this struct -... -LL | c: usize, - | ^ -... -LL | e: usize, - | ^ - | -note: the lint level is defined here - --> $DIR/multiple-dead-codes-in-the-same-struct.rs:8:12 - | -LL | #[deny(dead_code)] - | ^^^^^^^^^ - -error: field `b` is never read - --> $DIR/multiple-dead-codes-in-the-same-struct.rs:7:5 - | -LL | struct Bar { - | --- field in this struct -... -LL | b: usize, - | ^ - | -note: the lint level is defined here - --> $DIR/multiple-dead-codes-in-the-same-struct.rs:6:14 - | -LL | #[forbid(dead_code)] - | ^^^^^^^^^ - -error: aborting due to 2 previous errors; 1 warning emitted - diff --git a/src/test/ui/lint/dead-code/newline-span.rs b/src/test/ui/lint/dead-code/newline-span.rs deleted file mode 100644 index 209c3cd93..000000000 --- a/src/test/ui/lint/dead-code/newline-span.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![deny(dead_code)] - -fn unused() { //~ error: function `unused` is never used - println!("blah"); -} - -fn unused2(var: i32) { //~ error: function `unused2` is never used - println!("foo {}", var); -} - -fn unused3( //~ error: function `unused3` is never used - var: i32, -) { - println!("bar {}", var); -} - -fn main() { - println!("Hello world!"); -} diff --git a/src/test/ui/lint/dead-code/newline-span.stderr b/src/test/ui/lint/dead-code/newline-span.stderr deleted file mode 100644 index 4eeadccc8..000000000 --- a/src/test/ui/lint/dead-code/newline-span.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: function `unused` is never used - --> $DIR/newline-span.rs:3:4 - | -LL | fn unused() { - | ^^^^^^ - | -note: the lint level is defined here - --> $DIR/newline-span.rs:1:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: function `unused2` is never used - --> $DIR/newline-span.rs:7:4 - | -LL | fn unused2(var: i32) { - | ^^^^^^^ - -error: function `unused3` is never used - --> $DIR/newline-span.rs:11:4 - | -LL | fn unused3( - | ^^^^^^^ - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/lint/dead-code/self-assign.rs b/src/test/ui/lint/dead-code/self-assign.rs deleted file mode 100644 index ea7ce98d8..000000000 --- a/src/test/ui/lint/dead-code/self-assign.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Test that dead code warnings are issued for superfluous assignments of -// fields or variables to themselves (issue #75356). - -// ignore-test FIXME(81658, 83171) - -// check-pass -#![allow(unused_assignments)] -#![warn(dead_code)] - -fn main() { - let mut x = 0; - x = x; - //~^ WARNING: useless assignment of variable of type `i32` to itself - - x = (x); - //~^ WARNING: useless assignment of variable of type `i32` to itself - - x = {x}; - // block expressions don't count as self-assignments - - - struct S<'a> { f: &'a str } - let mut s = S { f: "abc" }; - s = s; - //~^ WARNING: useless assignment of variable of type `S` to itself - - s.f = s.f; - //~^ WARNING: useless assignment of field of type `&str` to itself - - - struct N0 { x: Box } - struct N1 { n: N0 } - struct N2(N1); - struct N3 { n: N2 }; - let mut n3 = N3 { n: N2(N1 { n: N0 { x: Box::new(42) } }) }; - n3.n.0.n.x = n3.n.0.n.x; - //~^ WARNING: useless assignment of field of type `Box` to itself - - let mut t = (1, ((2, 3, (4, 5)),)); - t.1.0.2.1 = t.1.0.2.1; - //~^ WARNING: useless assignment of field of type `i32` to itself - - - let mut y = 0; - macro_rules! assign_to_y { - ($cur:expr) => {{ - y = $cur; - }}; - } - assign_to_y!(y); - // self-assignments in macro expansions are not reported either -} diff --git a/src/test/ui/lint/dead-code/self-assign.stderr b/src/test/ui/lint/dead-code/self-assign.stderr deleted file mode 100644 index bb79c0ec7..000000000 --- a/src/test/ui/lint/dead-code/self-assign.stderr +++ /dev/null @@ -1,44 +0,0 @@ -warning: useless assignment of variable of type `i32` to itself - --> $DIR/self-assign.rs:10:5 - | -LL | x = x; - | ^^^^^ - | -note: the lint level is defined here - --> $DIR/self-assign.rs:6:9 - | -LL | #![warn(dead_code)] - | ^^^^^^^^^ - -warning: useless assignment of variable of type `i32` to itself - --> $DIR/self-assign.rs:13:5 - | -LL | x = (x); - | ^^^^^^^ - -warning: useless assignment of variable of type `S` to itself - --> $DIR/self-assign.rs:22:5 - | -LL | s = s; - | ^^^^^ - -warning: useless assignment of field of type `&str` to itself - --> $DIR/self-assign.rs:25:5 - | -LL | s.f = s.f; - | ^^^^^^^^^ - -warning: useless assignment of field of type `Box` to itself - --> $DIR/self-assign.rs:34:5 - | -LL | n3.n.0.n.x = n3.n.0.n.x; - | ^^^^^^^^^^^^^^^^^^^^^^^ - -warning: useless assignment of field of type `i32` to itself - --> $DIR/self-assign.rs:38:5 - | -LL | t.1.0.2.1 = t.1.0.2.1; - | ^^^^^^^^^^^^^^^^^^^^^ - -warning: 6 warnings emitted - diff --git a/src/test/ui/lint/dead-code/trait-impl.rs b/src/test/ui/lint/dead-code/trait-impl.rs deleted file mode 100644 index 92e389a93..000000000 --- a/src/test/ui/lint/dead-code/trait-impl.rs +++ /dev/null @@ -1,19 +0,0 @@ -// check-pass -#![deny(dead_code)] - -enum Foo { - Bar, -} - -fn main() { - let p = [0; 0]; - p.bar(); -} - -trait Bar { - fn bar(&self) -> usize { - 3 - } -} - -impl Bar for [u32; Foo::Bar as usize] {} diff --git a/src/test/ui/lint/dead-code/tuple-struct-field.rs b/src/test/ui/lint/dead-code/tuple-struct-field.rs deleted file mode 100644 index 14fb30be9..000000000 --- a/src/test/ui/lint/dead-code/tuple-struct-field.rs +++ /dev/null @@ -1,37 +0,0 @@ -#![deny(unused_tuple_struct_fields)] -//~^ NOTE: the lint level is defined here - -use std::marker::PhantomData; - -const LEN: usize = 4; - -struct SingleUnused(i32, [u8; LEN], String); -//~^ ERROR: field `1` is never read -//~| NOTE: field in this struct -//~| HELP: consider changing the field to be of unit type - -struct MultipleUnused(i32, f32, String, u8); -//~^ ERROR: fields `0`, `1`, `2`, and `3` are never read -//~| NOTE: fields in this struct -//~| HELP: consider changing the fields to be of unit type - -struct GoodUnit(()); - -struct GoodPhantom(PhantomData); - -struct Void; -struct GoodVoid(Void); - -fn main() { - let w = SingleUnused(42, [0, 1, 2, 3], "abc".to_string()); - let _ = w.0; - let _ = w.2; - - let m = MultipleUnused(42, 3.14, "def".to_string(), 4u8); - - let gu = GoodUnit(()); - let gp = GoodPhantom(PhantomData); - let gv = GoodVoid(Void); - - let _ = (gu, gp, gv, m); -} diff --git a/src/test/ui/lint/dead-code/tuple-struct-field.stderr b/src/test/ui/lint/dead-code/tuple-struct-field.stderr deleted file mode 100644 index b8ad5cbe4..000000000 --- a/src/test/ui/lint/dead-code/tuple-struct-field.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error: field `1` is never read - --> $DIR/tuple-struct-field.rs:8:26 - | -LL | struct SingleUnused(i32, [u8; LEN], String); - | ------------ ^^^^^^^^^ - | | - | field in this struct - | -note: the lint level is defined here - --> $DIR/tuple-struct-field.rs:1:9 - | -LL | #![deny(unused_tuple_struct_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field - | -LL | struct SingleUnused(i32, (), String); - | ~~ - -error: fields `0`, `1`, `2`, and `3` are never read - --> $DIR/tuple-struct-field.rs:13:23 - | -LL | struct MultipleUnused(i32, f32, String, u8); - | -------------- ^^^ ^^^ ^^^^^^ ^^ - | | - | fields in this struct - | -help: consider changing the fields to be of unit type to suppress this warning while preserving the field numbering, or remove the fields - | -LL | struct MultipleUnused((), (), (), ()); - | ~~ ~~ ~~ ~~ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/lint/dead-code/type-alias.rs b/src/test/ui/lint/dead-code/type-alias.rs deleted file mode 100644 index 35a7f125d..000000000 --- a/src/test/ui/lint/dead-code/type-alias.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![deny(dead_code)] - -type Used = u8; -type Unused = u8; //~ ERROR type alias `Unused` is never used - -fn id(x: Used) -> Used { x } - -fn main() { - id(0); -} diff --git a/src/test/ui/lint/dead-code/type-alias.stderr b/src/test/ui/lint/dead-code/type-alias.stderr deleted file mode 100644 index 446447d97..000000000 --- a/src/test/ui/lint/dead-code/type-alias.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: type alias `Unused` is never used - --> $DIR/type-alias.rs:4:6 - | -LL | type Unused = u8; - | ^^^^^^ - | -note: the lint level is defined here - --> $DIR/type-alias.rs:1:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/lint/dead-code/type-in-foreign.rs b/src/test/ui/lint/dead-code/type-in-foreign.rs deleted file mode 100644 index b6c593f31..000000000 --- a/src/test/ui/lint/dead-code/type-in-foreign.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Verify that we do not warn on types that are used by foreign functions. -// check-pass -#![deny(dead_code)] - -#[repr(C)] -struct Type(u8); - -#[repr(C)] -struct Param(u8); - -extern "C" { - #[allow(dead_code)] - fn hey(t: Param); - - #[allow(dead_code)] - static much: Type; -} - -fn main() {} diff --git a/src/test/ui/lint/dead-code/unused-enum.rs b/src/test/ui/lint/dead-code/unused-enum.rs deleted file mode 100644 index 20df3e1de..000000000 --- a/src/test/ui/lint/dead-code/unused-enum.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![deny(unused)] - -struct F; //~ ERROR struct `F` is never constructed -struct B; //~ ERROR struct `B` is never constructed - -enum E { - //~^ ERROR enum `E` is never used - Foo(F), - Bar(B), -} - -fn main() {} diff --git a/src/test/ui/lint/dead-code/unused-enum.stderr b/src/test/ui/lint/dead-code/unused-enum.stderr deleted file mode 100644 index d2602dbb3..000000000 --- a/src/test/ui/lint/dead-code/unused-enum.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error: struct `F` is never constructed - --> $DIR/unused-enum.rs:3:8 - | -LL | struct F; - | ^ - | -note: the lint level is defined here - --> $DIR/unused-enum.rs:1:9 - | -LL | #![deny(unused)] - | ^^^^^^ - = note: `#[deny(dead_code)]` implied by `#[deny(unused)]` - -error: struct `B` is never constructed - --> $DIR/unused-enum.rs:4:8 - | -LL | struct B; - | ^ - -error: enum `E` is never used - --> $DIR/unused-enum.rs:6:6 - | -LL | enum E { - | ^ - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/lint/dead-code/unused-struct-variant.rs b/src/test/ui/lint/dead-code/unused-struct-variant.rs deleted file mode 100644 index a914e0c33..000000000 --- a/src/test/ui/lint/dead-code/unused-struct-variant.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![deny(unused)] - -struct F; -struct B; - -enum E { - Foo(F), - Bar(B), //~ ERROR variant `Bar` is never constructed -} - -fn main() { - let _ = E::Foo(F); -} diff --git a/src/test/ui/lint/dead-code/unused-struct-variant.stderr b/src/test/ui/lint/dead-code/unused-struct-variant.stderr deleted file mode 100644 index d26dd3aff..000000000 --- a/src/test/ui/lint/dead-code/unused-struct-variant.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: variant `Bar` is never constructed - --> $DIR/unused-struct-variant.rs:8:5 - | -LL | enum E { - | - variant in this enum -LL | Foo(F), -LL | Bar(B), - | ^^^ - | -note: the lint level is 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 - diff --git a/src/test/ui/lint/dead-code/unused-variant-pub.rs b/src/test/ui/lint/dead-code/unused-variant-pub.rs deleted file mode 100644 index 3a9061340..000000000 --- a/src/test/ui/lint/dead-code/unused-variant-pub.rs +++ /dev/null @@ -1,14 +0,0 @@ -// build-pass -#![deny(unused)] - -pub struct F; -pub struct B; - -pub enum E { - Foo(F), - Bar(B), -} - -fn main() { - let _ = E::Foo(F); -} diff --git a/src/test/ui/lint/dead-code/unused-variant.rs b/src/test/ui/lint/dead-code/unused-variant.rs deleted file mode 100644 index 82108fa9c..000000000 --- a/src/test/ui/lint/dead-code/unused-variant.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![deny(dead_code)] - -#[derive(Clone)] -enum Enum { - Variant1, //~ ERROR: variant `Variant1` is never constructed - Variant2, -} - -fn main() { - let e = Enum::Variant2; - e.clone(); -} diff --git a/src/test/ui/lint/dead-code/unused-variant.stderr b/src/test/ui/lint/dead-code/unused-variant.stderr deleted file mode 100644 index 6029bf268..000000000 --- a/src/test/ui/lint/dead-code/unused-variant.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error: variant `Variant1` is never constructed - --> $DIR/unused-variant.rs:5:5 - | -LL | enum Enum { - | ---- variant in this enum -LL | Variant1, - | ^^^^^^^^ - | - = note: `Enum` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis -note: the lint level is defined here - --> $DIR/unused-variant.rs:1:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/lint/dead-code/with-core-crate.rs b/src/test/ui/lint/dead-code/with-core-crate.rs deleted file mode 100644 index 0a94b528f..000000000 --- a/src/test/ui/lint/dead-code/with-core-crate.rs +++ /dev/null @@ -1,18 +0,0 @@ -#![deny(dead_code)] -#![allow(unreachable_code)] - -#[macro_use] -extern crate core; - -fn foo() { //~ ERROR function `foo` is never used - - // none of these should have any dead_code exposed to the user - panic!(); - - panic!("foo"); - - panic!("bar {}", "baz") -} - - -fn main() {} diff --git a/src/test/ui/lint/dead-code/with-core-crate.stderr b/src/test/ui/lint/dead-code/with-core-crate.stderr deleted file mode 100644 index 7adcf8848..000000000 --- a/src/test/ui/lint/dead-code/with-core-crate.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: function `foo` is never used - --> $DIR/with-core-crate.rs:7:4 - | -LL | fn foo() { - | ^^^ - | -note: the lint level is defined here - --> $DIR/with-core-crate.rs:1:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/lint/dead-code/with-impl.rs b/src/test/ui/lint/dead-code/with-impl.rs deleted file mode 100644 index 812fcdd09..000000000 --- a/src/test/ui/lint/dead-code/with-impl.rs +++ /dev/null @@ -1,17 +0,0 @@ -// run-pass - -#![deny(dead_code)] - -pub struct GenericFoo(#[allow(unused_tuple_struct_fields)] T); - -type Foo = GenericFoo; - -impl Foo { - fn bar(self) -> u8 { - 0 - } -} - -fn main() { - println!("{}", GenericFoo(0).bar()); -} -- cgit v1.2.3