aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaiki Endo <te316e89@gmail.com>2024-01-07 13:09:58 +0900
committerTaiki Endo <te316e89@gmail.com>2024-01-07 13:20:09 +0900
commitb5f4978f546819785e165d533f5ce2c4cf51b980 (patch)
treea31250adc3be1ca1a035855930979e2732dfba4b
parent8f2c0887504d72e6b2052fe79fb64e9596f82c89 (diff)
downloadasync-task-b5f4978f546819785e165d533f5ce2c4cf51b980.tar.gz
Ignore dead_code warnings for tuple structs in tests
We use Box to be able to catch memory leaks using miri/valgrind. ``` error: field `0` is never read --> tests/join.rs:29:24 | 29 | struct Fut(Box<i32>); | --- ^^^^^^^^ | | | field in this struct ... 99 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: `-D dead-code` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(dead_code)]` = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 29 | struct Fut(()); | ~~ error: field `0` is never read --> tests/join.rs:47:24 | 47 | struct Out(Box<i32>, bool); | --- ^^^^^^^^ | | | field in this struct ... 99 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 47 | struct Out((), bool); | ~~ error: field `0` is never read --> tests/join.rs:75:26 | 75 | struct Guard(Box<i32>); | ----- ^^^^^^^^ | | | field in this struct ... 100 | schedule!(s, SCHEDULE, DROP_S); | ------------------------------ in this macro invocation | = note: this error originates in the macro `schedule` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 75 | struct Guard(()); | ~~ error: field `0` is never read --> tests/join.rs:29:24 | 29 | struct Fut(Box<i32>); | --- ^^^^^^^^ | | | field in this struct ... 118 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 29 | struct Fut(()); | ~~ error: field `0` is never read --> tests/join.rs:47:24 | 47 | struct Out(Box<i32>, bool); | --- ^^^^^^^^ | | | field in this struct ... 118 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 47 | struct Out((), bool); | ~~ error: field `0` is never read --> tests/join.rs:75:26 | 75 | struct Guard(Box<i32>); | ----- ^^^^^^^^ | | | field in this struct ... 119 | schedule!(s, SCHEDULE, DROP_S); | ------------------------------ in this macro invocation | = note: this error originates in the macro `schedule` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 75 | struct Guard(()); | ~~ error: field `0` is never read --> tests/join.rs:29:24 | 29 | struct Fut(Box<i32>); | --- ^^^^^^^^ | | | field in this struct ... 137 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 29 | struct Fut(()); | ~~ error: field `0` is never read --> tests/join.rs:47:24 | 47 | struct Out(Box<i32>, bool); | --- ^^^^^^^^ | | | field in this struct ... 137 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 47 | struct Out((), bool); | ~~ error: field `0` is never read --> tests/join.rs:75:26 | 75 | struct Guard(Box<i32>); | ----- ^^^^^^^^ | | | field in this struct ... 138 | schedule!(s, SCHEDULE, DROP_S); | ------------------------------ in this macro invocation | = note: this error originates in the macro `schedule` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 75 | struct Guard(()); | ~~ error: field `0` is never read --> tests/join.rs:29:24 | 29 | struct Fut(Box<i32>); | --- ^^^^^^^^ | | | field in this struct ... 156 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 29 | struct Fut(()); | ~~ error: field `0` is never read --> tests/join.rs:47:24 | 47 | struct Out(Box<i32>, bool); | --- ^^^^^^^^ | | | field in this struct ... 156 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 47 | struct Out((), bool); | ~~ error: field `0` is never read --> tests/join.rs:75:26 | 75 | struct Guard(Box<i32>); | ----- ^^^^^^^^ | | | field in this struct ... 157 | schedule!(s, SCHEDULE, DROP_S); | ------------------------------ in this macro invocation | = note: this error originates in the macro `schedule` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 75 | struct Guard(()); | ~~ error: field `0` is never read --> tests/join.rs:29:24 | 29 | struct Fut(Box<i32>); | --- ^^^^^^^^ | | | field in this struct ... 185 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 29 | struct Fut(()); | ~~ error: field `0` is never read --> tests/join.rs:47:24 | 47 | struct Out(Box<i32>, bool); | --- ^^^^^^^^ | | | field in this struct ... 185 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 47 | struct Out((), bool); | ~~ error: field `0` is never read --> tests/join.rs:75:26 | 75 | struct Guard(Box<i32>); | ----- ^^^^^^^^ | | | field in this struct ... 186 | schedule!(s, SCHEDULE, DROP_S); | ------------------------------ in this macro invocation | = note: this error originates in the macro `schedule` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 75 | struct Guard(()); | ~~ error: field `0` is never read --> tests/join.rs:29:24 | 29 | struct Fut(Box<i32>); | --- ^^^^^^^^ | | | field in this struct ... 216 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 29 | struct Fut(()); | ~~ error: field `0` is never read --> tests/join.rs:47:24 | 47 | struct Out(Box<i32>, bool); | --- ^^^^^^^^ | | | field in this struct ... 216 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 47 | struct Out((), bool); | ~~ error: field `0` is never read --> tests/join.rs:75:26 | 75 | struct Guard(Box<i32>); | ----- ^^^^^^^^ | | | field in this struct ... 217 | schedule!(s, SCHEDULE, DROP_S); | ------------------------------ in this macro invocation | = note: this error originates in the macro `schedule` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 75 | struct Guard(()); | ~~ error: field `0` is never read --> tests/join.rs:29:24 | 29 | struct Fut(Box<i32>); | --- ^^^^^^^^ | | | field in this struct ... 247 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 29 | struct Fut(()); | ~~ error: field `0` is never read --> tests/join.rs:47:24 | 47 | struct Out(Box<i32>, bool); | --- ^^^^^^^^ | | | field in this struct ... 247 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 47 | struct Out((), bool); | ~~ error: field `0` is never read --> tests/join.rs:75:26 | 75 | struct Guard(Box<i32>); | ----- ^^^^^^^^ | | | field in this struct ... 248 | schedule!(s, SCHEDULE, DROP_S); | ------------------------------ in this macro invocation | = note: this error originates in the macro `schedule` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 75 | struct Guard(()); | ~~ error: field `0` is never read --> tests/join.rs:29:24 | 29 | struct Fut(Box<i32>); | --- ^^^^^^^^ | | | field in this struct ... 285 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 29 | struct Fut(()); | ~~ error: field `0` is never read --> tests/join.rs:47:24 | 47 | struct Out(Box<i32>, bool); | --- ^^^^^^^^ | | | field in this struct ... 285 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 47 | struct Out((), bool); | ~~ error: field `0` is never read --> tests/join.rs:75:26 | 75 | struct Guard(Box<i32>); | ----- ^^^^^^^^ | | | field in this struct ... 286 | schedule!(s, SCHEDULE, DROP_S); | ------------------------------ in this macro invocation | = note: this error originates in the macro `schedule` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 75 | struct Guard(()); | ~~ error: field `0` is never read --> tests/join.rs:29:24 | 29 | struct Fut(Box<i32>); | --- ^^^^^^^^ | | | field in this struct ... 319 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 29 | struct Fut(()); | ~~ error: field `0` is never read --> tests/join.rs:47:24 | 47 | struct Out(Box<i32>, bool); | --- ^^^^^^^^ | | | field in this struct ... 319 | future!(f, POLL, DROP_F, DROP_T); | -------------------------------- in this macro invocation | = note: this error originates in the macro `future` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 47 | struct Out((), bool); | ~~ error: field `0` is never read --> tests/join.rs:75:26 | 75 | struct Guard(Box<i32>); | ----- ^^^^^^^^ | | | field in this struct ... 320 | schedule!(s, SCHEDULE, DROP_S); | ------------------------------ in this macro invocation | = note: this error originates in the macro `schedule` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 75 | struct Guard(()); | ~~ ```
-rw-r--r--tests/basic.rs4
-rw-r--r--tests/cancel.rs6
-rw-r--r--tests/join.rs6
-rw-r--r--tests/panic.rs4
-rw-r--r--tests/ready.rs6
-rw-r--r--tests/waker_panic.rs4
-rw-r--r--tests/waker_pending.rs4
-rw-r--r--tests/waker_ready.rs4
8 files changed, 19 insertions, 19 deletions
diff --git a/tests/basic.rs b/tests/basic.rs
index c9fb9f4..727a05e 100644
--- a/tests/basic.rs
+++ b/tests/basic.rs
@@ -21,7 +21,7 @@ macro_rules! future {
static $drop: AtomicUsize = AtomicUsize::new(0);
let $name = {
- struct Fut(Box<i32>);
+ struct Fut(#[allow(dead_code)] Box<i32>);
impl Future for Fut {
type Output = Box<i32>;
@@ -56,7 +56,7 @@ macro_rules! schedule {
static $sched: AtomicUsize = AtomicUsize::new(0);
let $name = {
- struct Guard(Box<i32>);
+ struct Guard(#[allow(dead_code)] Box<i32>);
impl Drop for Guard {
fn drop(&mut self) {
diff --git a/tests/cancel.rs b/tests/cancel.rs
index 0fe7c72..0333367 100644
--- a/tests/cancel.rs
+++ b/tests/cancel.rs
@@ -24,7 +24,7 @@ macro_rules! future {
static $drop_t: AtomicUsize = AtomicUsize::new(0);
let $name = {
- struct Fut(Box<i32>);
+ struct Fut(#[allow(dead_code)] Box<i32>);
impl Future for Fut {
type Output = Out;
@@ -43,7 +43,7 @@ macro_rules! future {
}
#[derive(Default)]
- struct Out(Box<i32>, bool);
+ struct Out(#[allow(dead_code)] Box<i32>, bool);
impl Drop for Out {
fn drop(&mut self) {
@@ -71,7 +71,7 @@ macro_rules! schedule {
static $sched: AtomicUsize = AtomicUsize::new(0);
let $name = {
- struct Guard(Box<i32>);
+ struct Guard(#[allow(dead_code)] Box<i32>);
impl Drop for Guard {
fn drop(&mut self) {
diff --git a/tests/join.rs b/tests/join.rs
index 2ac7b8d..089b5c1 100644
--- a/tests/join.rs
+++ b/tests/join.rs
@@ -26,7 +26,7 @@ macro_rules! future {
static $drop_t: AtomicUsize = AtomicUsize::new(0);
let $name = {
- struct Fut(Box<i32>);
+ struct Fut(#[allow(dead_code)] Box<i32>);
impl Future for Fut {
type Output = Out;
@@ -44,7 +44,7 @@ macro_rules! future {
}
#[derive(Default)]
- struct Out(Box<i32>, bool);
+ struct Out(#[allow(dead_code)] Box<i32>, bool);
impl Drop for Out {
fn drop(&mut self) {
@@ -72,7 +72,7 @@ macro_rules! schedule {
static $sched: AtomicUsize = AtomicUsize::new(0);
let $name = {
- struct Guard(Box<i32>);
+ struct Guard(#[allow(dead_code)] Box<i32>);
impl Drop for Guard {
fn drop(&mut self) {
diff --git a/tests/panic.rs b/tests/panic.rs
index 85684a0..726e385 100644
--- a/tests/panic.rs
+++ b/tests/panic.rs
@@ -23,7 +23,7 @@ macro_rules! future {
static $drop: AtomicUsize = AtomicUsize::new(0);
let $name = {
- struct Fut(Box<i32>);
+ struct Fut(#[allow(dead_code)] Box<i32>);
impl Future for Fut {
type Output = ();
@@ -59,7 +59,7 @@ macro_rules! schedule {
static $sched: AtomicUsize = AtomicUsize::new(0);
let $name = {
- struct Guard(Box<i32>);
+ struct Guard(#[allow(dead_code)] Box<i32>);
impl Drop for Guard {
fn drop(&mut self) {
diff --git a/tests/ready.rs b/tests/ready.rs
index e345565..aefb36e 100644
--- a/tests/ready.rs
+++ b/tests/ready.rs
@@ -24,7 +24,7 @@ macro_rules! future {
static $drop_t: AtomicUsize = AtomicUsize::new(0);
let $name = {
- struct Fut(Box<i32>);
+ struct Fut(#[allow(dead_code)] Box<i32>);
impl Future for Fut {
type Output = Out;
@@ -43,7 +43,7 @@ macro_rules! future {
}
#[derive(Default)]
- struct Out(Box<i32>, bool);
+ struct Out(#[allow(dead_code)] Box<i32>, bool);
impl Drop for Out {
fn drop(&mut self) {
@@ -71,7 +71,7 @@ macro_rules! schedule {
static $sched: AtomicUsize = AtomicUsize::new(0);
let $name = {
- struct Guard(Box<i32>);
+ struct Guard(#[allow(dead_code)] Box<i32>);
impl Drop for Guard {
fn drop(&mut self) {
diff --git a/tests/waker_panic.rs b/tests/waker_panic.rs
index 7a7792e..5b54f9d 100644
--- a/tests/waker_panic.rs
+++ b/tests/waker_panic.rs
@@ -29,7 +29,7 @@ macro_rules! future {
static WAKER: AtomicWaker = AtomicWaker::new();
let ($name, $get_waker) = {
- struct Fut(Cell<bool>, Box<i32>);
+ struct Fut(Cell<bool>, #[allow(dead_code)] Box<i32>);
impl Future for Fut {
type Output = ();
@@ -76,7 +76,7 @@ macro_rules! schedule {
let ($name, $chan) = {
let (s, r) = flume::unbounded();
- struct Guard(Box<i32>);
+ struct Guard(#[allow(dead_code)] Box<i32>);
impl Drop for Guard {
fn drop(&mut self) {
diff --git a/tests/waker_pending.rs b/tests/waker_pending.rs
index 9c95cba..ccd540b 100644
--- a/tests/waker_pending.rs
+++ b/tests/waker_pending.rs
@@ -26,7 +26,7 @@ macro_rules! future {
static WAKER: AtomicWaker = AtomicWaker::new();
let ($name, $get_waker) = {
- struct Fut(Box<i32>);
+ struct Fut(#[allow(dead_code)] Box<i32>);
impl Future for Fut {
type Output = ();
@@ -67,7 +67,7 @@ macro_rules! schedule {
let ($name, $chan) = {
let (s, r) = flume::unbounded();
- struct Guard(Box<i32>);
+ struct Guard(#[allow(dead_code)] Box<i32>);
impl Drop for Guard {
fn drop(&mut self) {
diff --git a/tests/waker_ready.rs b/tests/waker_ready.rs
index 335134e..b6f6b5f 100644
--- a/tests/waker_ready.rs
+++ b/tests/waker_ready.rs
@@ -26,7 +26,7 @@ macro_rules! future {
static WAKER: AtomicWaker = AtomicWaker::new();
let ($name, $get_waker) = {
- struct Fut(Cell<bool>, Box<i32>);
+ struct Fut(Cell<bool>, #[allow(dead_code)] Box<i32>);
impl Future for Fut {
type Output = Box<i32>;
@@ -73,7 +73,7 @@ macro_rules! schedule {
let ($name, $chan) = {
let (s, r) = flume::unbounded();
- struct Guard(Box<i32>);
+ struct Guard(#[allow(dead_code)] Box<i32>);
impl Drop for Guard {
fn drop(&mut self) {