Skip to content

Commit f3aa0df

Browse files
authored
Merge pull request #455 from reitermarkus/fix-ci
Fix CI.
2 parents c593fa5 + 7bb2f71 commit f3aa0df

14 files changed

+83
-165
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ stable_deref_trait = { version = "1", default-features = false }
5252

5353
[dev-dependencies]
5454
ufmt = "0.2"
55+
static_assertions = "1.1.0"
5556

5657
[package.metadata.docs.rs]
5758
features = ["ufmt", "serde", "defmt-03", "mpmc_large", "portable-atomic-critical-section"]

cfail/ui/not-send.rs

-24
This file was deleted.

cfail/ui/not-send.stderr

-123
This file was deleted.

src/binary_heap.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -564,9 +564,13 @@ where
564564

565565
#[cfg(test)]
566566
mod tests {
567-
use std::vec::Vec;
567+
use static_assertions::assert_not_impl_any;
568568

569-
use crate::binary_heap::{BinaryHeap, Max, Min};
569+
use super::{BinaryHeap, Max, Min};
570+
571+
// Ensure a `BinaryHeap` containing `!Send` values stays `!Send` itself.
572+
assert_not_impl_any!(BinaryHeap<*const (), Max, 4>: Send);
573+
assert_not_impl_any!(BinaryHeap<*const (), Min, 4>: Send);
570574

571575
#[test]
572576
fn static_new() {

src/deque.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,12 @@ where
745745

746746
#[cfg(test)]
747747
mod tests {
748-
use crate::Deque;
748+
use static_assertions::assert_not_impl_any;
749+
750+
use super::Deque;
751+
752+
// Ensure a `Deque` containing `!Send` values stays `!Send` itself.
753+
assert_not_impl_any!(Deque<*const (), 4>: Send);
749754

750755
#[test]
751756
fn static_new() {

src/histbuf.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,16 @@ impl<'a, T, const N: usize> Iterator for OldestOrdered<'a, T, N> {
433433

434434
#[cfg(test)]
435435
mod tests {
436-
use crate::HistoryBuffer;
437436
use core::fmt::Debug;
438437
use core::sync::atomic::{AtomicUsize, Ordering};
439438

439+
use static_assertions::assert_not_impl_any;
440+
441+
use super::HistoryBuffer;
442+
443+
// Ensure a `HistoryBuffer` containing `!Send` values stays `!Send` itself.
444+
assert_not_impl_any!(HistoryBuffer<*const (), 4>: Send);
445+
440446
#[test]
441447
fn new() {
442448
let x: HistoryBuffer<u8, 4> = HistoryBuffer::new_with(1);

src/indexmap.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use core::{
22
borrow::Borrow,
33
fmt,
44
hash::{BuildHasher, Hash},
5-
iter::FromIterator,
65
mem,
76
num::NonZeroU32,
87
ops, slice,
@@ -1263,10 +1262,17 @@ where
12631262

12641263
#[cfg(test)]
12651264
mod tests {
1266-
use crate::{indexmap::Entry, FnvIndexMap};
1267-
12681265
use core::mem;
12691266

1267+
use static_assertions::assert_not_impl_any;
1268+
1269+
use super::{BuildHasherDefault, Entry, FnvIndexMap, IndexMap};
1270+
1271+
// Ensure a `IndexMap` containing `!Send` keys stays `!Send` itself.
1272+
assert_not_impl_any!(IndexMap<*const (), (), BuildHasherDefault<()>, 4>: Send);
1273+
// Ensure a `IndexMap` containing `!Send` values stays `!Send` itself.
1274+
assert_not_impl_any!(IndexMap<(), *const (), BuildHasherDefault<()>, 4>: Send);
1275+
12701276
#[test]
12711277
fn size() {
12721278
const CAP: usize = 4;

src/indexset.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
use crate::indexmap::{self, IndexMap};
21
use core::{
32
borrow::Borrow,
43
fmt,
54
hash::{BuildHasher, Hash},
6-
iter::FromIterator,
75
};
6+
87
use hash32::{BuildHasherDefault, FnvHasher};
98

9+
use crate::indexmap::{self, IndexMap};
10+
1011
/// An [`IndexSet`] using the default FNV hasher.
1112
///
1213
/// A list of all Methods and Traits available for `FnvIndexSet` can be found in
@@ -660,3 +661,13 @@ where
660661
}
661662
}
662663
}
664+
665+
#[cfg(test)]
666+
mod tests {
667+
use static_assertions::assert_not_impl_any;
668+
669+
use super::{BuildHasherDefault, IndexSet};
670+
671+
// Ensure a `IndexSet` containing `!Send` values stays `!Send` itself.
672+
assert_not_impl_any!(IndexSet<*const (), BuildHasherDefault<()>, 4>: Send);
673+
}

src/linear_map.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
use core::{borrow::Borrow, fmt, mem, ops, slice};
2+
13
use crate::Vec;
2-
use core::{borrow::Borrow, fmt, iter::FromIterator, mem, ops, slice};
34

45
/// A fixed capacity map/dictionary that performs lookups via linear search.
56
///
@@ -492,7 +493,14 @@ where
492493

493494
#[cfg(test)]
494495
mod test {
495-
use crate::LinearMap;
496+
use static_assertions::assert_not_impl_any;
497+
498+
use super::LinearMap;
499+
500+
// Ensure a `LinearMap` containing `!Send` keys stays `!Send` itself.
501+
assert_not_impl_any!(LinearMap<*const (), (), 4>: Send);
502+
// Ensure a `LinearMap` containing `!Send` values stays `!Send` itself.
503+
assert_not_impl_any!(LinearMap<(), *const (), 4>: Send);
496504

497505
#[test]
498506
fn static_new() {

src/mpmc.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,12 @@ unsafe fn enqueue<T>(
294294

295295
#[cfg(test)]
296296
mod tests {
297-
use super::Q2;
297+
use static_assertions::assert_not_impl_any;
298+
299+
use super::{MpMcQueue, Q2};
300+
301+
// Ensure a `MpMcQueue` containing `!Send` values stays `!Send` itself.
302+
assert_not_impl_any!(MpMcQueue<*const (), 4>: Send);
298303

299304
#[test]
300305
fn sanity() {

src/sorted_linked_list.rs

+5
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,13 @@ where
743743

744744
#[cfg(test)]
745745
mod tests {
746+
use static_assertions::assert_not_impl_any;
747+
746748
use super::*;
747749

750+
// Ensure a `SortedLinkedList` containing `!Send` values stays `!Send` itself.
751+
assert_not_impl_any!(SortedLinkedList<*const (), LinkedIndexU8, (), 4>: Send);
752+
748753
#[test]
749754
fn const_new() {
750755
static mut _V1: SortedLinkedList<u32, LinkedIndexU8, Max, 100> = SortedLinkedList::new_u8();

src/spsc.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,18 @@ impl<'a, T, const N: usize> Producer<'a, T, N> {
632632
mod tests {
633633
use std::hash::{Hash, Hasher};
634634

635-
use crate::spsc::Queue;
635+
use super::{Consumer, Producer, Queue};
636+
637+
use static_assertions::assert_not_impl_any;
638+
639+
// Ensure a `Queue` containing `!Send` values stays `!Send` itself.
640+
assert_not_impl_any!(Queue<*const (), 4>: Send);
641+
642+
// Ensure a `Producer` containing `!Send` values stays `!Send` itself.
643+
assert_not_impl_any!(Producer<*const (), 4>: Send);
644+
645+
// Ensure a `Consumer` containing `!Send` values stays `!Send` itself.
646+
assert_not_impl_any!(Consumer<*const (), 4>: Send);
636647

637648
#[test]
638649
fn full() {

src/string.rs

-1
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,6 @@ impl_try_from_num!(u64, 20);
733733
#[cfg(test)]
734734
mod tests {
735735
use crate::{String, Vec};
736-
use core::convert::TryFrom;
737736

738737
#[test]
739738
fn static_new() {

src/vec.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use core::{
22
cmp::Ordering,
3-
fmt, hash,
4-
iter::FromIterator,
5-
mem,
3+
fmt, hash, mem,
64
mem::{ManuallyDrop, MaybeUninit},
75
ops, ptr, slice,
86
};
@@ -2080,9 +2078,15 @@ where
20802078

20812079
#[cfg(test)]
20822080
mod tests {
2083-
use crate::Vec;
20842081
use core::fmt::Write;
20852082

2083+
use static_assertions::assert_not_impl_any;
2084+
2085+
use crate::Vec;
2086+
2087+
// Ensure a `Vec` containing `!Send` values stays `!Send` itself.
2088+
assert_not_impl_any!(Vec<*const (), 4>: Send);
2089+
20862090
#[test]
20872091
fn static_new() {
20882092
static mut _V: Vec<i32, 4> = Vec::new();

0 commit comments

Comments
 (0)