about summary refs log tree commit diff
path: root/tests/ui/const-generics
diff options
context:
space:
mode:
authorr0cky <mu001999@outlook.com>2024-06-05 23:20:09 +0800
committerr0cky <mu001999@outlook.com>2024-06-05 23:20:09 +0800
commit35130d7233e939cc9a6fd8b72a4baee2eb59c3b2 (patch)
treeea13e12817d949301828e9ff4f5775ca8ba9a31e /tests/ui/const-generics
parent2a2c29aafa50bf6fe53d66b32070eba59f860ac3 (diff)
downloadrust-35130d7233e939cc9a6fd8b72a4baee2eb59c3b2.tar.gz
rust-35130d7233e939cc9a6fd8b72a4baee2eb59c3b2.zip
Detect pub structs never constructed and unused associated constants in traits
Diffstat (limited to 'tests/ui/const-generics')
-rw-r--r--tests/ui/const-generics/defaults/repr-c-issue-82792.rs1
-rw-r--r--tests/ui/const-generics/generic_const_exprs/associated-consts.rs3
-rw-r--r--tests/ui/const-generics/transparent-maybeunit-array-wrapper.rs1
3 files changed, 4 insertions, 1 deletions
diff --git a/tests/ui/const-generics/defaults/repr-c-issue-82792.rs b/tests/ui/const-generics/defaults/repr-c-issue-82792.rs
index c23187598bc..4bf2fa761ea 100644
--- a/tests/ui/const-generics/defaults/repr-c-issue-82792.rs
+++ b/tests/ui/const-generics/defaults/repr-c-issue-82792.rs
@@ -2,6 +2,7 @@
 
 //@ run-pass
 
+#[allow(dead_code)]
 #[repr(C)]
 pub struct Loaf<T: Sized, const N: usize = 1> {
     head: [T; N],
diff --git a/tests/ui/const-generics/generic_const_exprs/associated-consts.rs b/tests/ui/const-generics/generic_const_exprs/associated-consts.rs
index 5d2198f50ad..50a6102c605 100644
--- a/tests/ui/const-generics/generic_const_exprs/associated-consts.rs
+++ b/tests/ui/const-generics/generic_const_exprs/associated-consts.rs
@@ -16,7 +16,8 @@ impl BlockCipher for BarCipher {
     const BLOCK_SIZE: usize = 32;
 }
 
-pub struct Block<C>(#[allow(dead_code)] C);
+#[allow(dead_code)]
+pub struct Block<C>(C);
 
 pub fn test<C: BlockCipher, const M: usize>()
 where
diff --git a/tests/ui/const-generics/transparent-maybeunit-array-wrapper.rs b/tests/ui/const-generics/transparent-maybeunit-array-wrapper.rs
index 419d605d0c8..35c41ae4615 100644
--- a/tests/ui/const-generics/transparent-maybeunit-array-wrapper.rs
+++ b/tests/ui/const-generics/transparent-maybeunit-array-wrapper.rs
@@ -6,6 +6,7 @@
 
 use std::mem::MaybeUninit;
 
+#[allow(dead_code)]
 #[repr(transparent)]
 pub struct MaybeUninitWrapper<const N: usize>(MaybeUninit<[u64; N]>);