From 228503f96664cd47476e6a58efa1d3f4145674ed Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 5 Jan 2024 18:36:41 -0800 Subject: [PATCH 1/2] Work around new dead_code warning warning: field `0` is never read --> src/marker.rs:15:39 | 15 | pub(crate) struct ProcMacroAutoTraits(Rc<()>); | ------------------- ^^^^^^ | | | field in this struct | = note: `#[warn(dead_code)]` on by default help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 15 | pub(crate) struct ProcMacroAutoTraits(()); | ~~ --- src/marker.rs | 2 +- tests/ui/test-not-send.stderr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/marker.rs b/src/marker.rs index e648dd2..25c1555 100644 --- a/src/marker.rs +++ b/src/marker.rs @@ -12,7 +12,7 @@ mod value { pub(crate) use core::marker::PhantomData as Marker; } -pub(crate) struct ProcMacroAutoTraits(Rc<()>); +pub(crate) struct ProcMacroAutoTraits(#[allow(dead_code)] Rc<()>); impl UnwindSafe for ProcMacroAutoTraits {} impl RefUnwindSafe for ProcMacroAutoTraits {} diff --git a/tests/ui/test-not-send.stderr b/tests/ui/test-not-send.stderr index ea84607..d215533 100644 --- a/tests/ui/test-not-send.stderr +++ b/tests/ui/test-not-send.stderr @@ -31,7 +31,7 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely note: required because it appears within the type `proc_macro2::marker::ProcMacroAutoTraits` --> $WORKSPACE/src/marker.rs | - | pub(crate) struct ProcMacroAutoTraits(Rc<()>); + | pub(crate) struct ProcMacroAutoTraits(#[allow(dead_code)] Rc<()>); | ^^^^^^^^^^^^^^^^^^^ note: required because it appears within the type `PhantomData` --> $RUST/core/src/marker.rs From 436ce07eedae4db7e0138d3d8d55d8666b2ba3a4 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 5 Jan 2024 18:46:57 -0800 Subject: [PATCH 2/2] Add link to dead_code autotrait bug https://github.com/rust-lang/rust/issues/119645 --- src/marker.rs | 5 ++++- tests/ui/test-not-send.stderr | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/marker.rs b/src/marker.rs index 25c1555..e8874bd 100644 --- a/src/marker.rs +++ b/src/marker.rs @@ -12,7 +12,10 @@ mod value { pub(crate) use core::marker::PhantomData as Marker; } -pub(crate) struct ProcMacroAutoTraits(#[allow(dead_code)] Rc<()>); +pub(crate) struct ProcMacroAutoTraits( + #[allow(dead_code)] // https://github.com/rust-lang/rust/issues/119645 + Rc<()>, +); impl UnwindSafe for ProcMacroAutoTraits {} impl RefUnwindSafe for ProcMacroAutoTraits {} diff --git a/tests/ui/test-not-send.stderr b/tests/ui/test-not-send.stderr index d215533..abaab5a 100644 --- a/tests/ui/test-not-send.stderr +++ b/tests/ui/test-not-send.stderr @@ -31,7 +31,7 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely note: required because it appears within the type `proc_macro2::marker::ProcMacroAutoTraits` --> $WORKSPACE/src/marker.rs | - | pub(crate) struct ProcMacroAutoTraits(#[allow(dead_code)] Rc<()>); + | pub(crate) struct ProcMacroAutoTraits( | ^^^^^^^^^^^^^^^^^^^ note: required because it appears within the type `PhantomData` --> $RUST/core/src/marker.rs