Skip to content

Commit f3aa0df

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

File tree

14 files changed

+83
-165
lines changed

14 files changed

+83
-165
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
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

Lines changed: 0 additions & 24 deletions
This file was deleted.

cfail/ui/not-send.stderr

Lines changed: 0 additions & 123 deletions
This file was deleted.

src/binary_heap.rs

Lines changed: 6 additions & 2 deletions
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

Lines changed: 6 additions & 1 deletion
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

Lines changed: 7 additions & 1 deletion
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

Lines changed: 9 additions & 3 deletions
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

Lines changed: 13 additions & 2 deletions
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

Lines changed: 10 additions & 2 deletions
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

Lines changed: 6 additions & 1 deletion
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() {

0 commit comments

Comments
 (0)