Skip to content

Commit b5f4978

Browse files
committed
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(()); | ~~ ```
1 parent 8f2c088 commit b5f4978

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

tests/basic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ macro_rules! future {
2121
static $drop: AtomicUsize = AtomicUsize::new(0);
2222

2323
let $name = {
24-
struct Fut(Box<i32>);
24+
struct Fut(#[allow(dead_code)] Box<i32>);
2525

2626
impl Future for Fut {
2727
type Output = Box<i32>;
@@ -56,7 +56,7 @@ macro_rules! schedule {
5656
static $sched: AtomicUsize = AtomicUsize::new(0);
5757

5858
let $name = {
59-
struct Guard(Box<i32>);
59+
struct Guard(#[allow(dead_code)] Box<i32>);
6060

6161
impl Drop for Guard {
6262
fn drop(&mut self) {

tests/cancel.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ macro_rules! future {
2424
static $drop_t: AtomicUsize = AtomicUsize::new(0);
2525

2626
let $name = {
27-
struct Fut(Box<i32>);
27+
struct Fut(#[allow(dead_code)] Box<i32>);
2828

2929
impl Future for Fut {
3030
type Output = Out;
@@ -43,7 +43,7 @@ macro_rules! future {
4343
}
4444

4545
#[derive(Default)]
46-
struct Out(Box<i32>, bool);
46+
struct Out(#[allow(dead_code)] Box<i32>, bool);
4747

4848
impl Drop for Out {
4949
fn drop(&mut self) {
@@ -71,7 +71,7 @@ macro_rules! schedule {
7171
static $sched: AtomicUsize = AtomicUsize::new(0);
7272

7373
let $name = {
74-
struct Guard(Box<i32>);
74+
struct Guard(#[allow(dead_code)] Box<i32>);
7575

7676
impl Drop for Guard {
7777
fn drop(&mut self) {

tests/join.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ macro_rules! future {
2626
static $drop_t: AtomicUsize = AtomicUsize::new(0);
2727

2828
let $name = {
29-
struct Fut(Box<i32>);
29+
struct Fut(#[allow(dead_code)] Box<i32>);
3030

3131
impl Future for Fut {
3232
type Output = Out;
@@ -44,7 +44,7 @@ macro_rules! future {
4444
}
4545

4646
#[derive(Default)]
47-
struct Out(Box<i32>, bool);
47+
struct Out(#[allow(dead_code)] Box<i32>, bool);
4848

4949
impl Drop for Out {
5050
fn drop(&mut self) {
@@ -72,7 +72,7 @@ macro_rules! schedule {
7272
static $sched: AtomicUsize = AtomicUsize::new(0);
7373

7474
let $name = {
75-
struct Guard(Box<i32>);
75+
struct Guard(#[allow(dead_code)] Box<i32>);
7676

7777
impl Drop for Guard {
7878
fn drop(&mut self) {

tests/panic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ macro_rules! future {
2323
static $drop: AtomicUsize = AtomicUsize::new(0);
2424

2525
let $name = {
26-
struct Fut(Box<i32>);
26+
struct Fut(#[allow(dead_code)] Box<i32>);
2727

2828
impl Future for Fut {
2929
type Output = ();
@@ -59,7 +59,7 @@ macro_rules! schedule {
5959
static $sched: AtomicUsize = AtomicUsize::new(0);
6060

6161
let $name = {
62-
struct Guard(Box<i32>);
62+
struct Guard(#[allow(dead_code)] Box<i32>);
6363

6464
impl Drop for Guard {
6565
fn drop(&mut self) {

tests/ready.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ macro_rules! future {
2424
static $drop_t: AtomicUsize = AtomicUsize::new(0);
2525

2626
let $name = {
27-
struct Fut(Box<i32>);
27+
struct Fut(#[allow(dead_code)] Box<i32>);
2828

2929
impl Future for Fut {
3030
type Output = Out;
@@ -43,7 +43,7 @@ macro_rules! future {
4343
}
4444

4545
#[derive(Default)]
46-
struct Out(Box<i32>, bool);
46+
struct Out(#[allow(dead_code)] Box<i32>, bool);
4747

4848
impl Drop for Out {
4949
fn drop(&mut self) {
@@ -71,7 +71,7 @@ macro_rules! schedule {
7171
static $sched: AtomicUsize = AtomicUsize::new(0);
7272

7373
let $name = {
74-
struct Guard(Box<i32>);
74+
struct Guard(#[allow(dead_code)] Box<i32>);
7575

7676
impl Drop for Guard {
7777
fn drop(&mut self) {

tests/waker_panic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ macro_rules! future {
2929
static WAKER: AtomicWaker = AtomicWaker::new();
3030

3131
let ($name, $get_waker) = {
32-
struct Fut(Cell<bool>, Box<i32>);
32+
struct Fut(Cell<bool>, #[allow(dead_code)] Box<i32>);
3333

3434
impl Future for Fut {
3535
type Output = ();
@@ -76,7 +76,7 @@ macro_rules! schedule {
7676
let ($name, $chan) = {
7777
let (s, r) = flume::unbounded();
7878

79-
struct Guard(Box<i32>);
79+
struct Guard(#[allow(dead_code)] Box<i32>);
8080

8181
impl Drop for Guard {
8282
fn drop(&mut self) {

tests/waker_pending.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ macro_rules! future {
2626
static WAKER: AtomicWaker = AtomicWaker::new();
2727

2828
let ($name, $get_waker) = {
29-
struct Fut(Box<i32>);
29+
struct Fut(#[allow(dead_code)] Box<i32>);
3030

3131
impl Future for Fut {
3232
type Output = ();
@@ -67,7 +67,7 @@ macro_rules! schedule {
6767
let ($name, $chan) = {
6868
let (s, r) = flume::unbounded();
6969

70-
struct Guard(Box<i32>);
70+
struct Guard(#[allow(dead_code)] Box<i32>);
7171

7272
impl Drop for Guard {
7373
fn drop(&mut self) {

tests/waker_ready.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ macro_rules! future {
2626
static WAKER: AtomicWaker = AtomicWaker::new();
2727

2828
let ($name, $get_waker) = {
29-
struct Fut(Cell<bool>, Box<i32>);
29+
struct Fut(Cell<bool>, #[allow(dead_code)] Box<i32>);
3030

3131
impl Future for Fut {
3232
type Output = Box<i32>;
@@ -73,7 +73,7 @@ macro_rules! schedule {
7373
let ($name, $chan) = {
7474
let (s, r) = flume::unbounded();
7575

76-
struct Guard(Box<i32>);
76+
struct Guard(#[allow(dead_code)] Box<i32>);
7777

7878
impl Drop for Guard {
7979
fn drop(&mut self) {

0 commit comments

Comments
 (0)