diff options
Diffstat (limited to 'src/tools/clippy/tests/ui/non_send_fields_in_send_ty.rs')
-rw-r--r-- | src/tools/clippy/tests/ui/non_send_fields_in_send_ty.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/non_send_fields_in_send_ty.rs b/src/tools/clippy/tests/ui/non_send_fields_in_send_ty.rs index 514fb25c8..c6855a096 100644 --- a/src/tools/clippy/tests/ui/non_send_fields_in_send_ty.rs +++ b/src/tools/clippy/tests/ui/non_send_fields_in_send_ty.rs @@ -15,6 +15,7 @@ pub struct RingBuffer<T> { } unsafe impl<T> Send for RingBuffer<T> {} +//~^ ERROR: some fields in `RingBuffer<T>` are not safe to be sent to another thread // noise_search / RUSTSEC-2020-0141 pub struct MvccRwLock<T> { @@ -23,6 +24,7 @@ pub struct MvccRwLock<T> { } unsafe impl<T> Send for MvccRwLock<T> {} +//~^ ERROR: some fields in `MvccRwLock<T>` are not safe to be sent to another thread // async-coap / RUSTSEC-2020-0124 pub struct ArcGuard<RC, T> { @@ -31,6 +33,7 @@ pub struct ArcGuard<RC, T> { } unsafe impl<RC, T: Send> Send for ArcGuard<RC, T> {} +//~^ ERROR: some fields in `ArcGuard<RC, T>` are not safe to be sent to another thread // rusb / RUSTSEC-2020-0098 extern "C" { @@ -47,6 +50,7 @@ pub struct DeviceHandle<T: UsbContext> { } unsafe impl<T: UsbContext> Send for DeviceHandle<T> {} +//~^ ERROR: some fields in `DeviceHandle<T>` are not safe to be sent to another thread // Other basic tests pub struct NoGeneric { @@ -54,6 +58,7 @@ pub struct NoGeneric { } unsafe impl Send for NoGeneric {} +//~^ ERROR: some fields in `NoGeneric` are not safe to be sent to another thread pub struct MultiField<T> { field1: T, @@ -62,6 +67,7 @@ pub struct MultiField<T> { } unsafe impl<T> Send for MultiField<T> {} +//~^ ERROR: some fields in `MultiField<T>` are not safe to be sent to another thread pub enum MyOption<T> { MySome(T), @@ -69,6 +75,7 @@ pub enum MyOption<T> { } unsafe impl<T> Send for MyOption<T> {} +//~^ ERROR: some fields in `MyOption<T>` are not safe to be sent to another thread // Test types that contain `NonNull` instead of raw pointers (#8045) pub struct WrappedNonNull(UnsafeCell<NonNull<()>>); @@ -81,6 +88,7 @@ pub struct MultiParam<A, B> { } unsafe impl<A, B> Send for MultiParam<A, B> {} +//~^ ERROR: some fields in `MultiParam<A, B>` are not safe to be sent to another thread // Tests for raw pointer heuristic extern "C" { @@ -99,6 +107,7 @@ pub struct HeuristicTest { } unsafe impl Send for HeuristicTest {} +//~^ ERROR: some fields in `HeuristicTest` are not safe to be sent to another thread // Test attributes #[allow(clippy::non_send_fields_in_send_ty)] @@ -118,6 +127,7 @@ pub enum AttrTest3<T> { unsafe impl<T> Send for AttrTest1<T> {} unsafe impl<T> Send for AttrTest2<T> {} unsafe impl<T> Send for AttrTest3<T> {} +//~^ ERROR: some fields in `AttrTest3<T>` are not safe to be sent to another thread // Multiple non-overlapping `Send` for a single type pub struct Complex<A, B> { @@ -126,8 +136,10 @@ pub struct Complex<A, B> { } unsafe impl<P> Send for Complex<P, u32> {} +//~^ ERROR: some fields in `Complex<P, u32>` are not safe to be sent to another thread // `MutexGuard` is non-Send unsafe impl<Q: Send> Send for Complex<Q, MutexGuard<'static, bool>> {} +//~^ ERROR: some fields in `Complex<Q, MutexGuard<'static, bool>>` are not safe to be sent fn main() {} |