Adjust compiler tests for unused_tuple_struct_fields -> dead_code

This commit is contained in:
Jake Goulding 2023-12-27 17:11:58 -05:00
parent 5772818dc8
commit 53eca9fa87
166 changed files with 223 additions and 209 deletions

View file

@ -34,9 +34,9 @@ enum EnumNoDrop<T1, T2> {
}
struct NonGenericNoDrop(#[allow(unused_tuple_struct_fields)] i32);
struct NonGenericNoDrop(#[allow(dead_code)] i32);
struct NonGenericWithDrop(#[allow(unused_tuple_struct_fields)] i32);
struct NonGenericWithDrop(#[allow(dead_code)] i32);
//~ MONO_ITEM fn std::ptr::drop_in_place::<NonGenericWithDrop> - shim(Some(NonGenericWithDrop)) @@ generic_drop_glue-cgu.0[Internal]
impl Drop for NonGenericWithDrop {

View file

@ -6,9 +6,9 @@
#![feature(start)]
//~ MONO_ITEM fn std::ptr::drop_in_place::<Root> - shim(Some(Root)) @@ transitive_drop_glue-cgu.0[Internal]
struct Root(#[allow(unused_tuple_struct_fields)] Intermediate);
struct Root(#[allow(dead_code)] Intermediate);
//~ MONO_ITEM fn std::ptr::drop_in_place::<Intermediate> - shim(Some(Intermediate)) @@ transitive_drop_glue-cgu.0[Internal]
struct Intermediate(#[allow(unused_tuple_struct_fields)] Leaf);
struct Intermediate(#[allow(dead_code)] Leaf);
//~ MONO_ITEM fn std::ptr::drop_in_place::<Leaf> - shim(Some(Leaf)) @@ transitive_drop_glue-cgu.0[Internal]
struct Leaf;
@ -17,9 +17,9 @@ impl Drop for Leaf {
fn drop(&mut self) {}
}
struct RootGen<T>(#[allow(unused_tuple_struct_fields)] IntermediateGen<T>);
struct IntermediateGen<T>(#[allow(unused_tuple_struct_fields)] LeafGen<T>);
struct LeafGen<T>(#[allow(unused_tuple_struct_fields)] T);
struct RootGen<T>(#[allow(dead_code)] IntermediateGen<T>);
struct IntermediateGen<T>(#[allow(dead_code)] LeafGen<T>);
struct LeafGen<T>(#[allow(dead_code)] T);
impl<T> Drop for LeafGen<T> {
fn drop(&mut self) {}

View file

@ -40,7 +40,7 @@ fn foo(&self) {}
}
#[derive(Clone, Copy)]
struct Wrapper<T: ?Sized>(#[allow(unused_tuple_struct_fields)] *const T);
struct Wrapper<T: ?Sized>(#[allow(dead_code)] *const T);
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Wrapper<U>> for Wrapper<T> {}

View file

@ -74,7 +74,7 @@ fn panic(panic_info: &core::panic::PanicInfo) -> ! {
extern "C" fn rust_eh_personality() {}
#[derive(Default, Debug)]
struct Page(#[allow(unused_tuple_struct_fields)] [[u64; 32]; 16]);
struct Page(#[allow(dead_code)] [[u64; 32]; 16]);
#[no_mangle]
fn main(_argc: i32, _argv: *const *const u8) -> isize {

View file

@ -61,7 +61,7 @@ fn panic(panic_info: &core::panic::PanicInfo) -> ! {
extern "C" fn rust_eh_personality() {}
#[derive(Default, Debug)]
struct Page(#[allow(unused_tuple_struct_fields)] [[u64; 32]; 16]);
struct Page(#[allow(dead_code)] [[u64; 32]; 16]);
#[no_mangle]
fn main(_argc: i32, _argv: *const *const u8) -> isize {

View file

@ -1,7 +1,7 @@
// run-pass
#[derive(Debug)]
struct Foo(#[allow(unused_tuple_struct_fields)] Box<[u8]>);
struct Foo(#[allow(dead_code)] Box<[u8]>);
pub fn main() {
println!("{:?}", Foo(Box::new([0, 1, 2])));

View file

@ -17,7 +17,7 @@ impl Foo for Def {
const X: i32 = 97;
}
struct Proxy<T>(#[allow(unused_tuple_struct_fields)] T);
struct Proxy<T>(#[allow(dead_code)] T);
impl<T: Foo> Foo for Proxy<T> {
const X: i32 = T::X;

View file

@ -5,7 +5,7 @@
trait Device {
type Resources;
}
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
struct Foo<D, R>(D, R);
trait Tr {

View file

@ -9,7 +9,7 @@ pub trait UnifyKey {
fn dummy(&self) { }
}
pub struct Node<K:UnifyKey>(#[allow(unused_tuple_struct_fields)] K, K::Value);
pub struct Node<K:UnifyKey>(#[allow(dead_code)] K, K::Value);
fn foo<K : UnifyKey<Value=Option<V>>,V : Clone>(node: &Node<K>) -> Option<V> {
node.1.clone()

View file

@ -1,5 +1,5 @@
// run-pass
struct S<T: 'static>(#[allow(unused_tuple_struct_fields)] Option<&'static T>);
struct S<T: 'static>(#[allow(dead_code)] Option<&'static T>);
trait Tr { type Out; }
impl<T> Tr for T { type Out = T; }

View file

@ -3,9 +3,9 @@ pub trait Parser {
type Input;
}
pub struct Iter<P: Parser>(#[allow(unused_tuple_struct_fields)] P, P::Input);
pub struct Iter<P: Parser>(#[allow(dead_code)] P, P::Input);
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
pub struct Map<P, F>(P, F);
impl<P, F> Parser for Map<P, F> where F: FnMut(P) {
type Input = u8;

View file

@ -1,4 +1,4 @@
struct S<T: 'static>(#[allow(unused_tuple_struct_fields)] Option<&'static T>);
struct S<T: 'static>(#[allow(dead_code)] Option<&'static T>);
trait Tr { type Out; }
impl<T> Tr for T { type Out = T; }

View file

@ -17,7 +17,7 @@
use std::task::{Context, Poll};
const BIG_FUT_SIZE: usize = 1024;
struct BigFut(#[allow(unused_tuple_struct_fields)] [u8; BIG_FUT_SIZE]);
struct BigFut(#[allow(dead_code)] [u8; BIG_FUT_SIZE]);
impl BigFut {
fn new() -> Self {

View file

@ -17,7 +17,7 @@
use std::task::{Context, Poll};
const BIG_FUT_SIZE: usize = 1024;
struct Big(#[allow(unused_tuple_struct_fields)] [u8; BIG_FUT_SIZE]);
struct Big(#[allow(dead_code)] [u8; BIG_FUT_SIZE]);
impl Big {
fn new() -> Self {

View file

@ -9,7 +9,7 @@
impl !Auto for bool {}
impl !AutoUnsafe for bool {}
struct AutoBool(#[allow(unused_tuple_struct_fields)] bool);
struct AutoBool(#[allow(dead_code)] bool);
impl Auto for AutoBool {}
unsafe impl AutoUnsafe for AutoBool {}

View file

@ -15,7 +15,7 @@ fn chain<P>(self, p: P) -> Chain<Self, P> where Self: Sized {
}
}
struct Token<T>(#[allow(unused_tuple_struct_fields)] T::Item) where T: Iterator;
struct Token<T>(#[allow(dead_code)] T::Item) where T: Iterator;
impl<T> Parser for Token<T> where T: Iterator {
type Input = T;
@ -25,7 +25,7 @@ fn parse(self, _input: Self::Input) -> Result<(Self::Output, Self::Input), ()> {
}
}
struct Chain<L, R>(#[allow(unused_tuple_struct_fields)] L, #[allow(unused_tuple_struct_fields)] R);
struct Chain<L, R>(#[allow(dead_code)] L, #[allow(dead_code)] R);
impl<L, R> Parser for Chain<L, R> where L: Parser, R: Parser<Input = L::Input> {
type Input = L::Input;

View file

@ -3,7 +3,7 @@
#![allow(non_camel_case_types)]
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
enum color {
rgb(isize, isize, isize),
rgba(isize, isize, isize, isize),

View file

@ -1,7 +1,7 @@
// run-pass
#![allow(non_camel_case_types)]
enum blah { a(isize, isize, #[allow(unused_tuple_struct_fields)] usize), b(isize, isize), c, }
enum blah { a(isize, isize, #[allow(dead_code)] usize), b(isize, isize), c, }
fn or_alt(q: blah) -> isize {
match q { blah::a(x, y, _) | blah::b(x, y) => { return x + y; } blah::c => { return 0; } }

View file

@ -3,6 +3,6 @@
// pretty-expanded FIXME #23616
enum clam<T> { a(#[allow(unused_tuple_struct_fields)] T), }
enum clam<T> { a(#[allow(dead_code)] T), }
pub fn main() { let c = clam::a(2); match c { clam::a::<isize>(_) => { } } }

View file

@ -12,7 +12,7 @@
use std::marker;
#[derive(Copy, Clone)]
struct X<T>(#[allow(unused_tuple_struct_fields)] T);
struct X<T>(#[allow(dead_code)] T);
impl<T:Sync> RequiresShare for X<T> { }

View file

@ -51,10 +51,10 @@ fn test_sync_trait() {
}
/* Test Clone Trait Migration */
struct S(Foo);
struct S(#[allow(dead_code)] Foo);
struct T(i32);
struct U(S, T);
struct U(#[allow(dead_code)] S, T);
impl Clone for U {
fn clone(&self) -> Self {

View file

@ -51,10 +51,10 @@ fn test_sync_trait() {
}
/* Test Clone Trait Migration */
struct S(Foo);
struct S(#[allow(dead_code)] Foo);
struct T(i32);
struct U(S, T);
struct U(#[allow(dead_code)] S, T);
impl Clone for U {
fn clone(&self) -> Self {

View file

@ -18,10 +18,10 @@ impl Foo {
}
}
struct S(#[allow(unused_tuple_struct_fields)] Foo);
struct S(#[allow(dead_code)] Foo);
#[derive(Clone)]
struct T(#[allow(unused_tuple_struct_fields)] i32);
struct T(#[allow(dead_code)] i32);
struct U(S, T);

View file

@ -18,10 +18,10 @@ fn from(s: &str) -> Self {
}
}
struct S(#[allow(unused_tuple_struct_fields)] Foo);
struct S(#[allow(dead_code)] Foo);
#[derive(Clone)]
struct T(#[allow(unused_tuple_struct_fields)] i32);
struct T(#[allow(dead_code)] i32);
struct U(S, T);

View file

@ -13,7 +13,7 @@ impl Drop for Foo {
}
#[derive(Debug)]
struct ConstainsDropField(Foo, #[allow(unused_tuple_struct_fields)] Foo);
struct ConstainsDropField(Foo, #[allow(dead_code)] Foo);
// `t` needs Drop because one of its elements needs drop,
// therefore precise capture might affect drop ordering

View file

@ -13,7 +13,7 @@ fn drop(&mut self) {
}
#[derive(Debug)]
struct ConstainsDropField(Foo, #[allow(unused_tuple_struct_fields)] Foo);
struct ConstainsDropField(Foo, #[allow(dead_code)] Foo);
// `t` needs Drop because one of its elements needs drop,
// therefore precise capture might affect drop ordering

View file

@ -2,7 +2,7 @@
#![allow(unused_variables)]
#![allow(unused_assignments)]
#[derive(Debug)]
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
enum Foo {
Bar(u32, u32),
Baz(&'static u32, &'static u32)

View file

@ -20,5 +20,5 @@ fn send(&self, _: T) {}
}
trait Foo { fn dummy(&self) { }}
struct Output(#[allow(unused_tuple_struct_fields)] isize);
struct Output(#[allow(dead_code)] isize);
impl Foo for Output {}

View file

@ -4,7 +4,7 @@
extern crate const_generic_lib;
struct Container(#[allow(unused_tuple_struct_fields)] const_generic_lib::Alias);
struct Container(#[allow(dead_code)] const_generic_lib::Alias);
fn main() {
let res = const_generic_lib::function(const_generic_lib::Struct([14u8, 1u8, 2u8]));

View file

@ -16,7 +16,7 @@ impl BlockCipher for BarCipher {
const BLOCK_SIZE: usize = 32;
}
pub struct Block<C>(#[allow(unused_tuple_struct_fields)] C);
pub struct Block<C>(#[allow(dead_code)] C);
pub fn test<C: BlockCipher, const M: usize>()
where

View file

@ -9,7 +9,7 @@ trait Foo {
const ASSOC: usize = 1;
}
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
struct Iced<T: Foo>(T, [(); T::ASSOC])
where
[(); T::ASSOC]: ;

View file

@ -9,7 +9,7 @@ trait Foo {
const ASSOC: usize = 1;
}
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
struct Iced<T: Foo>(T, [(); T::ASSOC])
where
[(); T::ASSOC]: ;

View file

@ -6,7 +6,7 @@ trait Nat {
}
struct Zero;
struct Succ<N>(#[allow(unused_tuple_struct_fields)] N);
struct Succ<N>(#[allow(dead_code)] N);
impl Nat for Zero {
const VALUE: usize = 0;

View file

@ -2,10 +2,10 @@
use std::mem;
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
struct Trivial(u8, f32);
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
struct NonTrivial(u8, String);
const CONST_U8: bool = mem::needs_drop::<u8>();

View file

@ -5,7 +5,7 @@
use std::{mem, ptr};
struct Foo(#[allow(unused_tuple_struct_fields)] u32);
struct Foo(#[allow(dead_code)] u32);
#[derive(Clone, Copy)]
struct Bar {

View file

@ -1,7 +1,7 @@
// run-pass
// Eventually this will be rejected (when the future-compat lints are turned into hard errors), and
// then this test can be removed. But meanwhile we should ensure that this works and does not ICE.
struct NoDerive(i32);
struct NoDerive(#[allow(dead_code)] i32);
#[derive(PartialEq)]
struct WrapEmbedded(*const NoDerive);

View file

@ -15,7 +15,7 @@
#![warn(indirect_structural_match)]
#[derive(Copy, Clone, Debug)]
struct NoDerive(#[allow(unused_tuple_struct_fields)] u32);
struct NoDerive(#[allow(dead_code)] u32);
// This impl makes `NoDerive` irreflexive.
impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }

View file

@ -1,7 +1,7 @@
// run-pass
const HASH_LEN: usize = 20;
struct Hash(#[allow(unused_tuple_struct_fields)] [u8; HASH_LEN]);
struct Hash(#[allow(dead_code)] [u8; HASH_LEN]);
fn init_hash(_: &mut [u8; HASH_LEN]) {}
fn foo<'a>() -> &'a () {

View file

@ -4,7 +4,7 @@
static FLAG: AtomicBool = AtomicBool::new(false);
struct NoisyDrop(&'static str);
struct NoisyDrop(#[allow(dead_code)] &'static str);
impl Drop for NoisyDrop {
fn drop(&mut self) {
FLAG.store(true, Ordering::SeqCst);

View file

@ -4,7 +4,7 @@
const NONE_CELL_STRING: Option<Cell<String>> = None;
struct Foo<T>(#[allow(unused_tuple_struct_fields)] T);
struct Foo<T>(#[allow(dead_code)] T);
impl<T> Foo<T> {
const FOO: Option<Box<T>> = None;
}

View file

@ -3,7 +3,7 @@
use std::mem;
#[repr(transparent)]
struct Foo(#[allow(unused_tuple_struct_fields)] u32);
struct Foo(#[allow(dead_code)] u32);
const TRANSMUTED_U32: u32 = unsafe { mem::transmute(Foo(3)) };

View file

@ -18,7 +18,7 @@
use std::ops::Coroutine;
const FOO_SIZE: usize = 1024;
struct Foo(#[allow(unused_tuple_struct_fields)] [u8; FOO_SIZE]);
struct Foo(#[allow(dead_code)] [u8; FOO_SIZE]);
impl Drop for Foo {
fn drop(&mut self) {}

View file

@ -9,7 +9,7 @@ enum Void {}
#[derive(Debug)]
enum Foo {
Bar(u8),
Bar(#[allow(dead_code)] u8),
Void(Void), //~ WARN variant `Void` is never constructed
}

View file

@ -3,7 +3,7 @@ warning: variant `Void` is never constructed
|
LL | enum Foo {
| --- variant in this enum
LL | Bar(u8),
LL | Bar(#[allow(dead_code)] u8),
LL | Void(Void),
| ^^^^
|

View file

@ -2,7 +2,7 @@
// pretty-expanded FIXME #23616
#[derive(Clone)]
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
struct S<T>(T, ());
pub fn main() {

View file

@ -23,7 +23,7 @@ fn clone(&self) -> Self {
/// This struct is actually Copy... at least, it thinks it is!
#[derive(Copy, Clone)]
struct Innocent(#[allow(unused_tuple_struct_fields)] Liar);
struct Innocent(#[allow(dead_code)] Liar);
impl Innocent {
fn new() -> Self {

View file

@ -3,7 +3,7 @@ fn main() {}
#[derive(Clone)]
pub struct Little;
#[derive(Clone)]
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
pub struct Big(
Little,
Little,

View file

@ -12,10 +12,10 @@
struct Dt<A: Foo>(&'static str, A);
struct Dr<'a, B:'a+Foo>(&'static str, &'a B);
struct Pt<A: Foo, B: Foo>(&'static str, #[allow(unused_tuple_struct_fields)] A, B);
struct Pr<'a, 'b, B:'a+'b+Foo>(&'static str, #[allow(unused_tuple_struct_fields)] &'a B, &'b B);
struct St<A: Foo>(&'static str, #[allow(unused_tuple_struct_fields)] A);
struct Sr<'a, B:'a+Foo>(&'static str, #[allow(unused_tuple_struct_fields)] &'a B);
struct Pt<A: Foo, B: Foo>(&'static str, #[allow(dead_code)] A, B);
struct Pr<'a, 'b, B:'a+'b+Foo>(&'static str, #[allow(dead_code)] &'a B, &'b B);
struct St<A: Foo>(&'static str, #[allow(dead_code)] A);
struct Sr<'a, B:'a+Foo>(&'static str, #[allow(dead_code)] &'a B);
impl<A: Foo> Drop for Dt<A> {
fn drop(&mut self) { println!("drop {}", self.0); self.1.foo(self.0); }

View file

@ -35,10 +35,10 @@
struct Dt<A: Foo>(&'static str, A);
struct Dr<'a, B:'a+Foo>(&'static str, &'a B);
struct Pt<A,B: Foo>(&'static str, #[allow(unused_tuple_struct_fields)] A, B);
struct Pr<'a, 'b, B:'a+'b+Foo>(&'static str, #[allow(unused_tuple_struct_fields)] &'a B, &'b B);
struct St<A: Foo>(&'static str, #[allow(unused_tuple_struct_fields)] A);
struct Sr<'a, B:'a+Foo>(&'static str, #[allow(unused_tuple_struct_fields)] &'a B);
struct Pt<A,B: Foo>(&'static str, #[allow(dead_code)] A, B);
struct Pr<'a, 'b, B:'a+'b+Foo>(&'static str, #[allow(dead_code)] &'a B, &'b B);
struct St<A: Foo>(&'static str, #[allow(dead_code)] A);
struct Sr<'a, B:'a+Foo>(&'static str, #[allow(dead_code)] &'a B);
impl<A: Foo> Drop for Dt<A> {
fn drop(&mut self) { println!("drop {}", self.0); self.1.foo(self.0); }

View file

@ -103,7 +103,7 @@ fn dynamic_drop(a: &Allocator, c: bool) {
};
}
struct TwoPtrs<'a>(Ptr<'a>, #[allow(unused_tuple_struct_fields)] Ptr<'a>);
struct TwoPtrs<'a>(Ptr<'a>, #[allow(dead_code)] Ptr<'a>);
fn struct_dynamic_drop(a: &Allocator, c0: bool, c1: bool, c: bool) {
for i in 0..2 {
let x;

View file

@ -19,7 +19,7 @@ impl<'a, T> UserDefined for &'a T { }
// ```
macro_rules! impl_drop {
($Bound:ident, $Id:ident) => {
struct $Id<T: $Bound>(#[allow(unused_tuple_struct_fields)] T);
struct $Id<T: $Bound>(#[allow(dead_code)] T);
unsafe impl <#[may_dangle] T: $Bound> Drop for $Id<T> {
fn drop(&mut self) { }
}

View file

@ -21,7 +21,7 @@ fn drop(&mut self) {
}
}
struct Foo<T>(u32, T, #[allow(unused_tuple_struct_fields)] Box<for <'r> fn(&'r T) -> String>);
struct Foo<T>(u32, T, #[allow(dead_code)] Box<for <'r> fn(&'r T) -> String>);
unsafe impl<#[may_dangle] T> Drop for Foo<T> {
fn drop(&mut self) {

View file

@ -6,7 +6,7 @@
use std::fmt::Debug;
#[derive(Debug)]
struct Foo(usize);
struct Foo(#[allow(dead_code)] usize);
impl Drop for Foo {
fn drop(&mut self) {

View file

@ -4,7 +4,7 @@
use std::mem;
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
enum ADT {
First(u32, u32),
Second(u64)

View file

@ -27,14 +27,14 @@ enum CLike3 {
D
}
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
enum ADT {
First(u32, u32),
Second(u64)
}
enum NullablePointer {
Something(#[allow(unused_tuple_struct_fields)] &'static u32),
Something(#[allow(dead_code)] &'static u32),
Nothing
}

View file

@ -5,7 +5,7 @@
extern crate default_type_params_xc;
struct Vec<T, A = default_type_params_xc::Heap>(#[allow(unused_tuple_struct_fields)] Option<(T,A)>);
struct Vec<T, A = default_type_params_xc::Heap>(#[allow(dead_code)] Option<(T,A)>);
struct Foo;

View file

@ -1,5 +1,5 @@
// run-pass
#![allow(non_camel_case_types)]
enum wrapper<T> { wrapped(#[allow(unused_tuple_struct_fields)] T), }
enum wrapper<T> { wrapped(#[allow(dead_code)] T), }
pub fn main() { let _w = wrapper::wrapped(vec![1, 2, 3, 4, 5]); }

View file

@ -1,7 +1,7 @@
// run-pass
// pretty-expanded FIXME #23616
struct S<T>(#[allow(unused_tuple_struct_fields)] T);
struct S<T>(#[allow(dead_code)] T);
pub fn main() {
let _s = S(2);

View file

@ -76,7 +76,7 @@ impl<T> Trait2<T> for Foo {
fn qux<'a>(x: &'a i32) -> &i32 { x } //~ ERROR functions generic over types or consts must be mangled
}
pub struct Bar<T>(#[allow(unused_tuple_struct_fields)] T);
pub struct Bar<T>(#[allow(dead_code)] T);
impl<T> Bar<T> {
@ -111,7 +111,7 @@ impl<T> Trait3 for Bar<T> {
fn baz<U>() {} //~ ERROR functions generic over types or consts must be mangled
}
pub struct Baz<'a>(#[allow(unused_tuple_struct_fields)] &'a i32);
pub struct Baz<'a>(#[allow(dead_code)] &'a i32);
impl<'a> Baz<'a> {
#[no_mangle]

View file

@ -76,7 +76,7 @@ fn baz(x: &i32) -> &i32 { x } //~ ERROR functions generic over types or consts m
fn qux<'a>(x: &'a i32) -> &i32 { x } //~ ERROR functions generic over types or consts must be mangled
}
pub struct Bar<T>(#[allow(unused_tuple_struct_fields)] T);
pub struct Bar<T>(#[allow(dead_code)] T);
impl<T> Bar<T> {
#[no_mangle]
@ -111,7 +111,7 @@ extern "C" fn bar() {} //~ ERROR functions generic over types or consts must be
fn baz<U>() {} //~ ERROR functions generic over types or consts must be mangled
}
pub struct Baz<'a>(#[allow(unused_tuple_struct_fields)] &'a i32);
pub struct Baz<'a>(#[allow(dead_code)] &'a i32);
impl<'a> Baz<'a> {
#[no_mangle]

View file

@ -1,7 +1,7 @@
// run-pass
#![allow(non_camel_case_types)]
enum list<T> { #[allow(unused_tuple_struct_fields)] cons(Box<T>, Box<list<T>>), nil, }
enum list<T> { #[allow(dead_code)] cons(Box<T>, Box<list<T>>), nil, }
pub fn main() {
let _a: list<isize> =

View file

@ -5,6 +5,6 @@
// This used to cause memory corruption in stage 0.
// pretty-expanded FIXME #23616
enum thing<K> { some(#[allow(unused_tuple_struct_fields)] K), }
enum thing<K> { some(#[allow(dead_code)] K), }
pub fn main() { let _x = thing::some("hi".to_string()); }

View file

@ -3,6 +3,6 @@
// pretty-expanded FIXME #23616
enum clam<T> { a(#[allow(unused_tuple_struct_fields)] T), }
enum clam<T> { a(#[allow(dead_code)] T), }
pub fn main() { let _c = clam::a(3); }

View file

@ -6,7 +6,7 @@
#![allow(unused_variables)]
enum option<T> { some(#[allow(unused_tuple_struct_fields)] Box<T>), none, }
enum option<T> { some(#[allow(dead_code)] Box<T>), none, }
pub fn main() {
let mut a: option<isize> = option::some::<isize>(Box::new(10));

View file

@ -15,7 +15,7 @@ pub fn future_from_coroutine<
GenFuture(x)
}
struct GenFuture<T: FakeCoroutine<Yield = ()>>(#[allow(unused_tuple_struct_fields)] T);
struct GenFuture<T: FakeCoroutine<Yield = ()>>(#[allow(dead_code)] T);
impl<T: FakeCoroutine<Yield = ()>> FakeFuture for GenFuture<T> {
type Output = T::Return;

View file

@ -7,7 +7,7 @@
use std::iter::FusedIterator;
struct Thing<'a>(#[allow(unused_tuple_struct_fields)] &'a str);
struct Thing<'a>(#[allow(dead_code)] &'a str);
impl<'a> Iterator for Thing<'a> {
type Item = &'a str;
fn next(&mut self) -> Option<&'a str> {

View file

@ -164,7 +164,7 @@ fn range_shadow_multi_pats() {
fn misc() {
enum Foo {
Bar(#[allow(unused_tuple_struct_fields)] usize, bool)
Bar(#[allow(dead_code)] usize, bool)
}
// This test basically mimics how trace_macros! macro is implemented,
// which is a rare combination of vector patterns, multiple wild-card

View file

@ -1,6 +1,6 @@
// run-pass
#[derive(Debug)]
struct Matrix4<S>(#[allow(unused_tuple_struct_fields)] S);
struct Matrix4<S>(#[allow(dead_code)] S);
trait POrd<S> {}
fn translate<S: POrd<S>>(s: S) -> Matrix4<S> { Matrix4(s) }

View file

@ -12,7 +12,7 @@ fn do_something(&mut self) {}
}
struct Foo<B: Bar>(#[allow(unused_tuple_struct_fields)] B);
struct Foo<B: Bar>(#[allow(dead_code)] B);
impl<B: Bar> Drop for Foo<B> {
fn drop(&mut self) {

View file

@ -1,7 +1,7 @@
// run-pass
#[derive(Debug)]
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
struct Pair<T, V> (T, V);
impl Pair<

View file

@ -1,7 +1,7 @@
// run-pass
#![allow(unused_variables)]
struct Node<T: ?Sized>(#[allow(unused_tuple_struct_fields)] T);
struct Node<T: ?Sized>(#[allow(dead_code)] T);
fn main() {
let x: Box<Node<[isize]>> = Box::new(Node([]));

View file

@ -4,7 +4,7 @@ fn method1() {}
fn method2();
}
struct Slice<'a, T: 'a>(#[allow(unused_tuple_struct_fields)] &'a [T]);
struct Slice<'a, T: 'a>(#[allow(dead_code)] &'a [T]);
impl<'a, T: 'a> Foo for Slice<'a, T> {
fn method2() {

View file

@ -4,7 +4,7 @@
use std::thread;
struct Foo(#[allow(unused_tuple_struct_fields)] i32);
struct Foo(#[allow(dead_code)] i32);
impl Drop for Foo {
fn drop(&mut self) {

View file

@ -2,7 +2,7 @@
trait Device {
type Resources;
}
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
struct Foo<D, R>(D, R);
impl<D: Device> Foo<D, D::Resources> {

View file

@ -1,7 +1,7 @@
// run-pass
trait Tr { type T; }
impl Tr for u8 { type T=(); }
struct S<I: Tr>(#[allow(unused_tuple_struct_fields)] I::T);
struct S<I: Tr>(#[allow(dead_code)] I::T);
fn foo<I: Tr>(i: I::T) {
S::<I>(i);

View file

@ -1,5 +1,5 @@
// run-pass
struct Parser<'a>(#[allow(unused_tuple_struct_fields)] Box<dyn FnMut(Parser) + 'a>);
struct Parser<'a>(#[allow(dead_code)] Box<dyn FnMut(Parser) + 'a>);
fn main() {
let _x = Parser(Box::new(|_|{}));

View file

@ -1,5 +1,5 @@
// run-pass
struct Wrapper<'a, T: ?Sized>(&'a mut i32, #[allow(unused_tuple_struct_fields)] T);
struct Wrapper<'a, T: ?Sized>(&'a mut i32, #[allow(dead_code)] T);
impl<'a, T: ?Sized> Drop for Wrapper<'a, T> {
fn drop(&mut self) {

View file

@ -2,12 +2,12 @@
#![allow(unused_assignments)]
#![allow(unused_variables)]
use std::fmt;
struct NoisyDrop<T: fmt::Debug>(#[allow(unused_tuple_struct_fields)] T);
struct NoisyDrop<T: fmt::Debug>(#[allow(dead_code)] T);
impl<T: fmt::Debug> Drop for NoisyDrop<T> {
fn drop(&mut self) {}
}
struct Bar<T: fmt::Debug>(#[allow(unused_tuple_struct_fields)] [*const NoisyDrop<T>; 2]);
struct Bar<T: fmt::Debug>(#[allow(dead_code)] [*const NoisyDrop<T>; 2]);
fn fine() {
let (u,b);
@ -15,7 +15,7 @@ fn fine() {
b = Bar([&NoisyDrop(&u), &NoisyDrop(&u)]);
}
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
struct Bar2<T: fmt::Debug>(*const NoisyDrop<T>, *const NoisyDrop<T>);
fn lolwut() {

View file

@ -6,7 +6,7 @@
use std::cell::Cell;
struct Concrete<'a>(#[allow(unused_tuple_struct_fields)] u32, Cell<Option<&'a Concrete<'a>>>);
struct Concrete<'a>(#[allow(dead_code)] u32, Cell<Option<&'a Concrete<'a>>>);
fn main() {
let mut data = Vec::new();

View file

@ -6,7 +6,7 @@
use std::cell::Cell;
struct Concrete<'a>(#[allow(unused_tuple_struct_fields)] u32, Cell<Option<&'a Concrete<'a>>>);
struct Concrete<'a>(#[allow(dead_code)] u32, Cell<Option<&'a Concrete<'a>>>);
struct Foo<T> { data: Vec<T> }

View file

@ -8,7 +8,7 @@
#![feature(dropck_eyepatch)]
use std::cell::Cell;
struct Concrete<'a>(#[allow(unused_tuple_struct_fields)] u32, Cell<Option<&'a Concrete<'a>>>);
struct Concrete<'a>(#[allow(dead_code)] u32, Cell<Option<&'a Concrete<'a>>>);
struct Foo<T> { data: Vec<T> }

View file

@ -6,7 +6,7 @@
const BAZ: Bar = Bar;
#[derive(Debug)]
struct Foo(#[allow(unused_tuple_struct_fields)] [Bar; 1]);
struct Foo(#[allow(dead_code)] [Bar; 1]);
struct Biz;

View file

@ -25,9 +25,9 @@ impl<T> Front for Vec<T> {
type Back = Vec<T>;
}
struct PtrBack<T: Front>(#[allow(unused_tuple_struct_fields)] Vec<T::Back>);
struct PtrBack<T: Front>(#[allow(dead_code)] Vec<T::Back>);
struct M(#[allow(unused_tuple_struct_fields)] PtrBack<Vec<M>>);
struct M(#[allow(dead_code)] PtrBack<Vec<M>>);
#[allow(unused_must_use)]
fn main() {

View file

@ -1,7 +1,7 @@
// run-pass
#[repr(u8)]
enum Foo {
Foo(#[allow(unused_tuple_struct_fields)] u8),
Foo(#[allow(dead_code)] u8),
}
fn main() {

View file

@ -5,7 +5,7 @@
use std::mem;
const SZ: usize = 100;
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
struct P<T: ?Sized>([u8; SZ], T);
type Ack<T> = P<P<T>>;

View file

@ -7,7 +7,7 @@ fn default_method<T: std::fmt::Debug>(&self, x: &T) {
}
#[derive(Debug)]
struct Y(#[allow(unused_tuple_struct_fields)] isize);
struct Y(#[allow(dead_code)] isize);
#[derive(Debug)]
struct Z<T: X+std::fmt::Debug> {

View file

@ -2,7 +2,7 @@
use std::iter::{Fuse, Cloned};
use std::slice::Iter;
struct Foo<'a, T: 'a>(#[allow(unused_tuple_struct_fields)] &'a T);
struct Foo<'a, T: 'a>(#[allow(dead_code)] &'a T);
impl<'a, T: 'a> Copy for Foo<'a, T> {}
impl<'a, T: 'a> Clone for Foo<'a, T> {
fn clone(&self) -> Self { *self }

View file

@ -1,7 +1,7 @@
// run-pass
// pretty-expanded FIXME #23616
struct A(#[allow(unused_tuple_struct_fields)] bool);
struct A(#[allow(dead_code)] bool);
pub fn main() {
let f = A;

View file

@ -4,7 +4,7 @@
use std::any::type_name;
struct Bar<M>(#[allow(unused_tuple_struct_fields)] M);
struct Bar<M>(#[allow(dead_code)] M);
impl<M> Bar<M> {
fn foo(&self) -> &'static str {

View file

@ -6,7 +6,7 @@
trait FooBar {
fn dummy(&self) { }
}
struct Bar(#[allow(unused_tuple_struct_fields)] i32);
struct Bar(#[allow(dead_code)] i32);
struct Foo { bar: Bar }
impl FooBar for Bar {}

View file

@ -2,7 +2,7 @@
use std::hint;
struct U16(u16);
struct U16(#[allow(dead_code)] u16);
impl Drop for U16 {
fn drop(&mut self) {
@ -23,7 +23,7 @@ struct Wrapper {
}
#[repr(packed)]
struct Misalign(u8, Wrapper);
struct Misalign(#[allow(dead_code)] u8, Wrapper);
fn main() {
let m = Misalign(

View file

@ -14,10 +14,10 @@
use std::num::NonZeroU32 as N32;
use std::sync::{Mutex, RwLock};
struct Wrapper<T>(#[allow(unused_tuple_struct_fields)] T);
struct Wrapper<T>(#[allow(dead_code)] T);
#[repr(transparent)]
struct Transparent<T>(#[allow(unused_tuple_struct_fields)] T);
struct Transparent<T>(#[allow(dead_code)] T);
struct NoNiche<T>(UnsafeCell<T>);

View file

@ -37,7 +37,7 @@ struct UsedStruct1 {
#[allow(dead_code)]
x: isize
}
struct UsedStruct2(isize);
struct UsedStruct2(#[allow(dead_code)] isize);
struct UsedStruct3;
pub struct UsedStruct4;
// this struct is never used directly, but its method is, so we don't want

View file

@ -2,12 +2,12 @@
#![deny(dead_code)]
enum Enum1 {
Variant1(isize),
Variant1(#[allow(dead_code)] isize),
Variant2 //~ ERROR: variant `Variant2` is never constructed
}
enum Enum2 {
Variant3(bool),
Variant3(#[allow(dead_code)] bool),
#[allow(dead_code)]
Variant4(isize),
Variant5 { _x: isize }, //~ ERROR: variants `Variant5` and `Variant6` are never constructed
@ -15,7 +15,7 @@ enum Enum2 {
_Variant7,
Variant8 { _field: bool },
Variant9,
Variant10(usize)
Variant10(#[allow(dead_code)] usize)
}
impl Enum2 {

View file

@ -3,7 +3,7 @@ error: variant `Variant2` is never constructed
|
LL | enum Enum1 {
| ----- variant in this enum
LL | Variant1(isize),
LL | Variant1(#[allow(dead_code)] isize),
LL | Variant2
| ^^^^^^^^
|

View file

@ -17,7 +17,7 @@ struct Bar {
// Issue 119267: this should not ICE.
#[derive(Debug)]
struct Foo(usize, #[allow(unused)] usize);
struct Foo(usize, #[allow(unused)] usize); //~ WARN field `0` is never read
fn main() {
Bar {

View file

@ -51,5 +51,19 @@ note: the lint level is defined here
LL | #[forbid(dead_code)]
| ^^^^^^^^^
error: aborting due to 2 previous errors; 1 warning emitted
warning: field `0` is never read
--> $DIR/multiple-dead-codes-in-the-same-struct.rs:20:12
|
LL | struct Foo(usize, #[allow(unused)] usize);
| --- ^^^^^
| |
| field in this struct
|
= note: `Foo` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
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 Foo((), #[allow(unused)] usize);
| ~~
error: aborting due to 2 previous errors; 2 warnings emitted

View file

@ -1,4 +1,4 @@
#![deny(unused_tuple_struct_fields)]
#![deny(dead_code)]
//~^ NOTE: the lint level is defined here
use std::marker::PhantomData;

View file

@ -9,8 +9,8 @@ LL | struct SingleUnused(i32, [u8; LEN], String);
note: the lint level is defined here
--> $DIR/tuple-struct-field.rs:1:9
|
LL | #![deny(unused_tuple_struct_fields)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | #![deny(dead_code)]
| ^^^^^^^^^
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);

View file

@ -2,7 +2,7 @@
#![deny(dead_code)]
pub struct GenericFoo<T>(#[allow(unused_tuple_struct_fields)] T);
pub struct GenericFoo<T>(#[allow(dead_code)] T);
type Foo = GenericFoo<u32>;

Some files were not shown because too many files have changed in this diff Show more