From bbb35110c67f83cedefe7965666d5610cccf55f5 Mon Sep 17 00:00:00 2001 From: amab8901 Date: Mon, 10 Apr 2023 14:25:43 +0200 Subject: [PATCH 1/5] Fix fuzz warnings --- tokio/src/lib.rs | 1 + tokio/src/util/linked_list.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index 688dd0c4d42..96da4b777d3 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -658,5 +658,6 @@ cfg_macros! { #[cfg(test)] fn is_unpin() {} +/// fuzz test (fuzz_linked_list) #[cfg(fuzzing)] pub mod fuzz; diff --git a/tokio/src/util/linked_list.rs b/tokio/src/util/linked_list.rs index 460e2564d4e..1971824a199 100644 --- a/tokio/src/util/linked_list.rs +++ b/tokio/src/util/linked_list.rs @@ -507,6 +507,7 @@ pub(crate) mod tests { } } + #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. macro_rules! assert_clean { ($e:ident) => {{ assert!($e.pointers.get_next().is_none()); @@ -514,6 +515,7 @@ pub(crate) mod tests { }}; } + #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. macro_rules! assert_ptr_eq { ($a:expr, $b:expr) => {{ // Deal with mapping a Pin<&mut T> -> Option> @@ -717,6 +719,7 @@ pub(crate) mod tests { } } + /// This is a fuzz test. You run it by entering `cargo fuzz run fuzz_linked_list` in CLI in `/tokio/` module. #[cfg(fuzzing)] pub fn fuzz_linked_list(ops: &[u8]) { enum Op { From bdc290f36e1766be89608e3632dde50eb5b1b379 Mon Sep 17 00:00:00 2001 From: amab8901 Date: Mon, 10 Apr 2023 14:54:49 +0200 Subject: [PATCH 2/5] fmt --- tokio/src/util/linked_list.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tokio/src/util/linked_list.rs b/tokio/src/util/linked_list.rs index 1971824a199..277b07e46c9 100644 --- a/tokio/src/util/linked_list.rs +++ b/tokio/src/util/linked_list.rs @@ -507,7 +507,7 @@ pub(crate) mod tests { } } - #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. + #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. macro_rules! assert_clean { ($e:ident) => {{ assert!($e.pointers.get_next().is_none()); @@ -515,7 +515,7 @@ pub(crate) mod tests { }}; } - #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. + #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. macro_rules! assert_ptr_eq { ($a:expr, $b:expr) => {{ // Deal with mapping a Pin<&mut T> -> Option> From ffcbb483ee26c63360eb101599a6cf7e570bba11 Mon Sep 17 00:00:00 2001 From: amab8901 Date: Mon, 10 Apr 2023 15:40:05 +0200 Subject: [PATCH 3/5] Will CI pass? --- tokio/src/util/linked_list.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tokio/src/util/linked_list.rs b/tokio/src/util/linked_list.rs index 277b07e46c9..1e4160fb3f3 100644 --- a/tokio/src/util/linked_list.rs +++ b/tokio/src/util/linked_list.rs @@ -507,7 +507,7 @@ pub(crate) mod tests { } } - #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. + // #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. macro_rules! assert_clean { ($e:ident) => {{ assert!($e.pointers.get_next().is_none()); @@ -515,7 +515,7 @@ pub(crate) mod tests { }}; } - #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. + // #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. macro_rules! assert_ptr_eq { ($a:expr, $b:expr) => {{ // Deal with mapping a Pin<&mut T> -> Option> From 476f7259fca2096c8e614136880df2b250e0b526 Mon Sep 17 00:00:00 2001 From: amab8901 Date: Mon, 10 Apr 2023 17:17:21 +0200 Subject: [PATCH 4/5] Try again --- tokio/src/util/linked_list.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tokio/src/util/linked_list.rs b/tokio/src/util/linked_list.rs index 1e4160fb3f3..277b07e46c9 100644 --- a/tokio/src/util/linked_list.rs +++ b/tokio/src/util/linked_list.rs @@ -507,7 +507,7 @@ pub(crate) mod tests { } } - // #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. + #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. macro_rules! assert_clean { ($e:ident) => {{ assert!($e.pointers.get_next().is_none()); @@ -515,7 +515,7 @@ pub(crate) mod tests { }}; } - // #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. + #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. macro_rules! assert_ptr_eq { ($a:expr, $b:expr) => {{ // Deal with mapping a Pin<&mut T> -> Option> From 2761e26126971621ba507dc32575c189dc42f274 Mon Sep 17 00:00:00 2001 From: amab8901 Date: Thu, 13 Apr 2023 06:00:42 +0200 Subject: [PATCH 5/5] #[cfg(test)] --- tokio/src/util/linked_list.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tokio/src/util/linked_list.rs b/tokio/src/util/linked_list.rs index 277b07e46c9..6bf26818423 100644 --- a/tokio/src/util/linked_list.rs +++ b/tokio/src/util/linked_list.rs @@ -507,7 +507,7 @@ pub(crate) mod tests { } } - #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. + #[cfg(test)] macro_rules! assert_clean { ($e:ident) => {{ assert!($e.pointers.get_next().is_none()); @@ -515,7 +515,7 @@ pub(crate) mod tests { }}; } - #[allow(unused_macros)] // This macro is used inside unsafe block but clippy doesn't see that. + #[cfg(test)] macro_rules! assert_ptr_eq { ($a:expr, $b:expr) => {{ // Deal with mapping a Pin<&mut T> -> Option>