about summary refs log tree commit diff
path: root/library
diff options
context:
space:
mode:
Diffstat (limited to 'library')
-rw-r--r--library/alloc/src/boxed.rs1
-rw-r--r--library/alloc/src/boxed/thin.rs2
-rw-r--r--library/alloc/src/collections/btree/set/tests.rs2
-rw-r--r--library/alloc/src/collections/vec_deque/tests.rs2
-rw-r--r--library/alloc/tests/autotraits.rs2
-rw-r--r--library/alloc/tests/vec.rs6
-rw-r--r--library/core/benches/slice.rs4
-rw-r--r--library/core/tests/any.rs2
-rw-r--r--library/core/tests/array.rs2
-rw-r--r--library/core/tests/atomic.rs2
-rw-r--r--library/core/tests/intrinsics.rs6
-rw-r--r--library/core/tests/ptr.rs38
-rw-r--r--library/core/tests/slice.rs6
-rw-r--r--library/std/src/collections/hash/set/tests.rs2
14 files changed, 39 insertions, 38 deletions
diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs
index fdf5e134f4d..6977681e5a3 100644
--- a/library/alloc/src/boxed.rs
+++ b/library/alloc/src/boxed.rs
@@ -24,6 +24,7 @@
 //! Creating a recursive data structure:
 //!
 //! ```
+//! ##[allow(dead_code)]
 //! #[derive(Debug)]
 //! enum List<T> {
 //!     Cons(T, Box<List<T>>),
diff --git a/library/alloc/src/boxed/thin.rs b/library/alloc/src/boxed/thin.rs
index a8005b7067d..9463b73b574 100644
--- a/library/alloc/src/boxed/thin.rs
+++ b/library/alloc/src/boxed/thin.rs
@@ -171,7 +171,7 @@ struct WithHeader<H>(NonNull<u8>, PhantomData<H>);
 /// An opaque representation of `WithHeader<H>` to avoid the
 /// projection invariance of `<T as Pointee>::Metadata`.
 #[repr(transparent)]
-#[allow(unused_tuple_struct_fields)] // Field only used through `WithHeader` type above.
+#[allow(dead_code)] // Field only used through `WithHeader` type above.
 struct WithOpaqueHeader(NonNull<u8>);
 
 impl WithOpaqueHeader {
diff --git a/library/alloc/src/collections/btree/set/tests.rs b/library/alloc/src/collections/btree/set/tests.rs
index 8726c5bfead..688ce57e9da 100644
--- a/library/alloc/src/collections/btree/set/tests.rs
+++ b/library/alloc/src/collections/btree/set/tests.rs
@@ -524,7 +524,7 @@ fn test_extend_ref() {
 #[test]
 fn test_recovery() {
     #[derive(Debug)]
-    struct Foo(&'static str, i32);
+    struct Foo(&'static str, #[allow(dead_code)] i32);
 
     impl PartialEq for Foo {
         fn eq(&self, other: &Self) -> bool {
diff --git a/library/alloc/src/collections/vec_deque/tests.rs b/library/alloc/src/collections/vec_deque/tests.rs
index b7fdebfa60b..f8ce4ca9788 100644
--- a/library/alloc/src/collections/vec_deque/tests.rs
+++ b/library/alloc/src/collections/vec_deque/tests.rs
@@ -1085,7 +1085,7 @@ fn test_clone_from() {
 fn test_vec_deque_truncate_drop() {
     static mut DROPS: u32 = 0;
     #[derive(Clone)]
-    struct Elem(i32);
+    struct Elem(#[allow(dead_code)] i32);
     impl Drop for Elem {
         fn drop(&mut self) {
             unsafe {
diff --git a/library/alloc/tests/autotraits.rs b/library/alloc/tests/autotraits.rs
index b41e457614e..ba5e28f7293 100644
--- a/library/alloc/tests/autotraits.rs
+++ b/library/alloc/tests/autotraits.rs
@@ -1,7 +1,7 @@
 fn require_sync<T: Sync>(_: T) {}
 fn require_send_sync<T: Send + Sync>(_: T) {}
 
-struct NotSend(*const ());
+struct NotSend(#[allow(dead_code)] *const ());
 unsafe impl Sync for NotSend {}
 
 #[test]
diff --git a/library/alloc/tests/vec.rs b/library/alloc/tests/vec.rs
index 364dc920187..9ec6f6ae1ac 100644
--- a/library/alloc/tests/vec.rs
+++ b/library/alloc/tests/vec.rs
@@ -547,7 +547,7 @@ fn test_cmp() {
 #[test]
 fn test_vec_truncate_drop() {
     static mut DROPS: u32 = 0;
-    struct Elem(i32);
+    struct Elem(#[allow(dead_code)] i32);
     impl Drop for Elem {
         fn drop(&mut self) {
             unsafe {
@@ -1089,7 +1089,7 @@ fn test_into_iter_advance_by() {
 
 #[test]
 fn test_into_iter_drop_allocator() {
-    struct ReferenceCountedAllocator<'a>(DropCounter<'a>);
+    struct ReferenceCountedAllocator<'a>(#[allow(dead_code)] DropCounter<'a>);
 
     unsafe impl Allocator for ReferenceCountedAllocator<'_> {
         fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, core::alloc::AllocError> {
@@ -2407,7 +2407,7 @@ fn test_vec_dedup_multiple_ident() {
 #[test]
 fn test_vec_dedup_partialeq() {
     #[derive(Debug)]
-    struct Foo(i32, i32);
+    struct Foo(i32, #[allow(dead_code)] i32);
 
     impl PartialEq for Foo {
         fn eq(&self, other: &Foo) -> bool {
diff --git a/library/core/benches/slice.rs b/library/core/benches/slice.rs
index 3bfb35e684e..8f87a211449 100644
--- a/library/core/benches/slice.rs
+++ b/library/core/benches/slice.rs
@@ -91,7 +91,7 @@ fn binary_search_l3_worst_case(b: &mut Bencher) {
 }
 
 #[derive(Clone)]
-struct Rgb(u8, u8, u8);
+struct Rgb(#[allow(dead_code)] u8, #[allow(dead_code)] u8, #[allow(dead_code)] u8);
 
 impl Rgb {
     fn gen(i: usize) -> Self {
@@ -154,7 +154,7 @@ swap_with_slice!(swap_with_slice_5x_usize_3000, 3000, |i| [i; 5]);
 #[bench]
 fn fill_byte_sized(b: &mut Bencher) {
     #[derive(Copy, Clone)]
-    struct NewType(u8);
+    struct NewType(#[allow(dead_code)] u8);
 
     let mut ary = [NewType(0); 1024];
 
diff --git a/library/core/tests/any.rs b/library/core/tests/any.rs
index 8d2d31b6431..25002617d0b 100644
--- a/library/core/tests/any.rs
+++ b/library/core/tests/any.rs
@@ -122,7 +122,7 @@ fn any_unsized() {
 fn distinct_type_names() {
     // https://github.com/rust-lang/rust/issues/84666
 
-    struct Velocity(f32, f32);
+    struct Velocity(#[allow(dead_code)] f32, #[allow(dead_code)] f32);
 
     fn type_name_of_val<T>(_: T) -> &'static str {
         type_name::<T>()
diff --git a/library/core/tests/array.rs b/library/core/tests/array.rs
index 3656eecca50..b1c1456ade1 100644
--- a/library/core/tests/array.rs
+++ b/library/core/tests/array.rs
@@ -262,7 +262,7 @@ fn array_default_impl_avoids_leaks_on_panic() {
     use core::sync::atomic::{AtomicUsize, Ordering::Relaxed};
     static COUNTER: AtomicUsize = AtomicUsize::new(0);
     #[derive(Debug)]
-    struct Bomb(usize);
+    struct Bomb(#[allow(dead_code)] usize);
 
     impl Default for Bomb {
         fn default() -> Bomb {
diff --git a/library/core/tests/atomic.rs b/library/core/tests/atomic.rs
index a67a842d340..0d1c72a6892 100644
--- a/library/core/tests/atomic.rs
+++ b/library/core/tests/atomic.rs
@@ -188,7 +188,7 @@ fn ptr_bitops() {
 #[cfg(any(not(target_arch = "arm"), target_os = "linux"))] // Missing intrinsic in compiler-builtins
 fn ptr_bitops_tagging() {
     #[repr(align(16))]
-    struct Tagme(u128);
+    struct Tagme(#[allow(dead_code)] u128);
 
     let tagme = Tagme(1000);
     let ptr = &tagme as *const Tagme as *mut Tagme;
diff --git a/library/core/tests/intrinsics.rs b/library/core/tests/intrinsics.rs
index 06870c6d06c..740565d0df6 100644
--- a/library/core/tests/intrinsics.rs
+++ b/library/core/tests/intrinsics.rs
@@ -4,7 +4,7 @@ use core::intrinsics::assume;
 #[test]
 fn test_typeid_sized_types() {
     struct X;
-    struct Y(u32);
+    struct Y(#[allow(dead_code)] u32);
 
     assert_eq!(TypeId::of::<X>(), TypeId::of::<X>());
     assert_eq!(TypeId::of::<Y>(), TypeId::of::<Y>());
@@ -14,8 +14,8 @@ fn test_typeid_sized_types() {
 #[test]
 fn test_typeid_unsized_types() {
     trait Z {}
-    struct X(str);
-    struct Y(dyn Z + 'static);
+    struct X(#[allow(dead_code)] str);
+    struct Y(#[allow(dead_code)] dyn Z + 'static);
 
     assert_eq!(TypeId::of::<X>(), TypeId::of::<X>());
     assert_eq!(TypeId::of::<Y>(), TypeId::of::<Y>());
diff --git a/library/core/tests/ptr.rs b/library/core/tests/ptr.rs
index ee885adfeee..238f29c5980 100644
--- a/library/core/tests/ptr.rs
+++ b/library/core/tests/ptr.rs
@@ -451,34 +451,34 @@ fn align_offset_various_strides() {
         for ptr in 1usize..4 * align {
             unsafe {
                 #[repr(packed)]
-                struct A3(u16, u8);
+                struct A3(#[allow(dead_code)] u16, #[allow(dead_code)] u8);
                 x |= test_stride::<A3>(ptr::invalid::<A3>(ptr), align);
 
-                struct A4(u32);
+                struct A4(#[allow(dead_code)] u32);
                 x |= test_stride::<A4>(ptr::invalid::<A4>(ptr), align);
 
                 #[repr(packed)]
-                struct A5(u32, u8);
+                struct A5(#[allow(dead_code)] u32, #[allow(dead_code)] u8);
                 x |= test_stride::<A5>(ptr::invalid::<A5>(ptr), align);
 
                 #[repr(packed)]
-                struct A6(u32, u16);
+                struct A6(#[allow(dead_code)] u32, #[allow(dead_code)] u16);
                 x |= test_stride::<A6>(ptr::invalid::<A6>(ptr), align);
 
                 #[repr(packed)]
-                struct A7(u32, u16, u8);
+                struct A7(#[allow(dead_code)] u32, #[allow(dead_code)] u16, #[allow(dead_code)] u8);
                 x |= test_stride::<A7>(ptr::invalid::<A7>(ptr), align);
 
                 #[repr(packed)]
-                struct A8(u32, u32);
+                struct A8(#[allow(dead_code)] u32, #[allow(dead_code)] u32);
                 x |= test_stride::<A8>(ptr::invalid::<A8>(ptr), align);
 
                 #[repr(packed)]
-                struct A9(u32, u32, u8);
+                struct A9(#[allow(dead_code)] u32, #[allow(dead_code)] u32, #[allow(dead_code)] u8);
                 x |= test_stride::<A9>(ptr::invalid::<A9>(ptr), align);
 
                 #[repr(packed)]
-                struct A10(u32, u32, u16);
+                struct A10(#[allow(dead_code)] u32, #[allow(dead_code)] u32, #[allow(dead_code)] u16);
                 x |= test_stride::<A10>(ptr::invalid::<A10>(ptr), align);
 
                 x |= test_stride::<u32>(ptr::invalid::<u32>(ptr), align);
@@ -517,34 +517,34 @@ fn align_offset_various_strides_const() {
             while ptr < 4 * align {
                 unsafe {
                     #[repr(packed)]
-                    struct A3(u16, u8);
+                    struct A3(#[allow(dead_code)] u16, #[allow(dead_code)] u8);
                     test_stride::<A3>(ptr::invalid::<A3>(ptr), ptr, align);
 
-                    struct A4(u32);
+                    struct A4(#[allow(dead_code)] u32);
                     test_stride::<A4>(ptr::invalid::<A4>(ptr), ptr, align);
 
                     #[repr(packed)]
-                    struct A5(u32, u8);
+                    struct A5(#[allow(dead_code)] u32, #[allow(dead_code)] u8);
                     test_stride::<A5>(ptr::invalid::<A5>(ptr), ptr, align);
 
                     #[repr(packed)]
-                    struct A6(u32, u16);
+                    struct A6(#[allow(dead_code)] u32, #[allow(dead_code)] u16);
                     test_stride::<A6>(ptr::invalid::<A6>(ptr), ptr, align);
 
                     #[repr(packed)]
-                    struct A7(u32, u16, u8);
+                    struct A7(#[allow(dead_code)] u32, #[allow(dead_code)] u16, #[allow(dead_code)] u8);
                     test_stride::<A7>(ptr::invalid::<A7>(ptr), ptr, align);
 
                     #[repr(packed)]
-                    struct A8(u32, u32);
+                    struct A8(#[allow(dead_code)] u32, #[allow(dead_code)] u32);
                     test_stride::<A8>(ptr::invalid::<A8>(ptr), ptr, align);
 
                     #[repr(packed)]
-                    struct A9(u32, u32, u8);
+                    struct A9(#[allow(dead_code)] u32, #[allow(dead_code)] u32, #[allow(dead_code)] u8);
                     test_stride::<A9>(ptr::invalid::<A9>(ptr), ptr, align);
 
                     #[repr(packed)]
-                    struct A10(u32, u32, u16);
+                    struct A10(#[allow(dead_code)] u32, #[allow(dead_code)] u32, #[allow(dead_code)] u16);
                     test_stride::<A10>(ptr::invalid::<A10>(ptr), ptr, align);
 
                     test_stride::<u32>(ptr::invalid::<u32>(ptr), ptr, align);
@@ -672,7 +672,7 @@ fn align_offset_issue_103361() {
     const SIZE: usize = 1 << 30;
     #[cfg(target_pointer_width = "16")]
     const SIZE: usize = 1 << 13;
-    struct HugeSize([u8; SIZE - 1]);
+    struct HugeSize(#[allow(dead_code)] [u8; SIZE - 1]);
     let _ = ptr::invalid::<HugeSize>(SIZE).align_offset(SIZE);
 }
 
@@ -684,7 +684,7 @@ fn align_offset_issue_103361_const() {
     const SIZE: usize = 1 << 30;
     #[cfg(target_pointer_width = "16")]
     const SIZE: usize = 1 << 13;
-    struct HugeSize([u8; SIZE - 1]);
+    struct HugeSize(#[allow(dead_code)] [u8; SIZE - 1]);
 
     const {
         assert!(ptr::invalid::<HugeSize>(SIZE - 1).align_offset(SIZE) == SIZE - 1);
@@ -834,7 +834,7 @@ fn ptr_metadata_bounds() {
 fn dyn_metadata() {
     #[derive(Debug)]
     #[repr(align(32))]
-    struct Something([u8; 47]);
+    struct Something(#[allow(dead_code)] [u8; 47]);
 
     let value = Something([0; 47]);
     let trait_object: &dyn Debug = &value;
diff --git a/library/core/tests/slice.rs b/library/core/tests/slice.rs
index 33a30339856..cc1fc7e4d7e 100644
--- a/library/core/tests/slice.rs
+++ b/library/core/tests/slice.rs
@@ -2109,9 +2109,9 @@ fn test_align_to_zst() {
 #[test]
 fn test_align_to_non_trivial() {
     #[repr(align(8))]
-    struct U64(u64, u64);
+    struct U64(#[allow(dead_code)] u64, #[allow(dead_code)] u64);
     #[repr(align(8))]
-    struct U64U64U32(u64, u64, u32);
+    struct U64U64U32(#[allow(dead_code)] u64, #[allow(dead_code)] u64, #[allow(dead_code)] u32);
     let data = [
         U64(1, 2),
         U64(3, 4),
@@ -2196,7 +2196,7 @@ fn test_slice_partition_dedup_multiple_ident() {
 #[test]
 fn test_slice_partition_dedup_partialeq() {
     #[derive(Debug)]
-    struct Foo(i32, i32);
+    struct Foo(i32, #[allow(dead_code)] i32);
 
     impl PartialEq for Foo {
         fn eq(&self, other: &Foo) -> bool {
diff --git a/library/std/src/collections/hash/set/tests.rs b/library/std/src/collections/hash/set/tests.rs
index 208f61e755c..a1884090043 100644
--- a/library/std/src/collections/hash/set/tests.rs
+++ b/library/std/src/collections/hash/set/tests.rs
@@ -352,7 +352,7 @@ fn test_replace() {
     use crate::hash;
 
     #[derive(Debug)]
-    struct Foo(&'static str, i32);
+    struct Foo(&'static str, #[allow(dead_code)] i32);
 
     impl PartialEq for Foo {
         fn eq(&self, other: &Self) -> bool {