Dataset Viewer
Auto-converted to Parquet Duplicate
instance_id
stringlengths
26
28
hints_text
stringlengths
0
16k
created_at
stringlengths
20
20
version
stringclasses
7 values
test_patch
stringlengths
350
480k
issue_numbers
sequencelengths
1
2
patch
stringlengths
288
411k
repo
stringclasses
1 value
pull_number
int64
27
1.1k
base_commit
stringlengths
40
40
problem_statement
stringlengths
123
49.6k
environment_setup_commit
stringclasses
7 values
crossbeam-rs__crossbeam-1101
Thanks for the report! IIUC, insert reduces the refcount of the old value and then sets the new value, so if insert makes the refcount zero, a get that occurs between the time the refcount is reduced and the new value is set will return None because it sees a deleted value with a refcount of zero. Do you have any plans to fix it I consider it a bug that needs to be fixed, but I'm not sure if I will be able to work on a fix anytime soon. It would be great if you or someone else could work on a fix.
2024-04-12T12:16:27Z
0.8
diff --git a/crossbeam-skiplist/tests/map.rs b/crossbeam-skiplist/tests/map.rs --- a/crossbeam-skiplist/tests/map.rs +++ b/crossbeam-skiplist/tests/map.rs @@ -920,3 +920,24 @@ fn clear() { assert!(s.is_empty()); assert_eq!(s.len(), 0); } + +// https://github.com/crossbeam-rs/crossbeam/issues/1023 +#[test] +fn concurrent_insert_get_same_key() { + use std::sync::Arc; + let map: Arc<SkipMap<u32, ()>> = Arc::new(SkipMap::new()); + let len = 10_0000; + let key = 0; + map.insert(0, ()); + + let getter = map.clone(); + let handle = std::thread::spawn(move || { + for _ in 0..len { + map.insert(0, ()); + } + }); + for _ in 0..len { + assert!(getter.get(&key).is_some()); + } + handle.join().unwrap() +} diff --git a/crossbeam-skiplist/tests/set.rs b/crossbeam-skiplist/tests/set.rs --- a/crossbeam-skiplist/tests/set.rs +++ b/crossbeam-skiplist/tests/set.rs @@ -692,3 +692,24 @@ fn clear() { assert!(s.is_empty()); assert_eq!(s.len(), 0); } + +// https://github.com/crossbeam-rs/crossbeam/issues/1023 +#[test] +fn concurrent_insert_get_same_key() { + use std::sync::Arc; + let set: Arc<SkipSet<u32>> = Arc::new(SkipSet::new()); + let len = 10_0000; + let key = 0; + set.insert(0); + + let getter = set.clone(); + let handle = std::thread::spawn(move || { + for _ in 0..len { + set.insert(0); + } + }); + for _ in 0..len { + assert!(getter.get(&key).is_some()); + } + handle.join().unwrap() +}
[ "1023" ]
diff --git a/crossbeam-skiplist/src/base.rs b/crossbeam-skiplist/src/base.rs --- a/crossbeam-skiplist/src/base.rs +++ b/crossbeam-skiplist/src/base.rs @@ -871,33 +871,17 @@ where // the lifetime of the guard. let guard = &*(guard as *const _); - let mut search; - loop { - // First try searching for the key. - // Note that the `Ord` implementation for `K` may panic during the search. - search = self.search_position(&key, guard); - - let r = match search.found { - Some(r) => r, - None => break, - }; + // First try searching for the key. + // Note that the `Ord` implementation for `K` may panic during the search. + let mut search = self.search_position(&key, guard); + if let Some(r) = search.found { let replace = replace(&r.value); - if replace { - // If a node with the key was found and we should replace it, mark its tower - // and then repeat the search. - if r.mark_tower() { - self.hot_data.len.fetch_sub(1, Ordering::Relaxed); - } - } else { + if !replace { // If a node with the key was found and we're not going to replace it, let's // try returning it as an entry. if let Some(e) = RefEntry::try_acquire(self, r) { return e; } - - // If we couldn't increment the reference count, that means someone has just - // now removed the node. - break; } } diff --git a/crossbeam-skiplist/src/base.rs b/crossbeam-skiplist/src/base.rs --- a/crossbeam-skiplist/src/base.rs +++ b/crossbeam-skiplist/src/base.rs @@ -937,6 +921,12 @@ where ) .is_ok() { + // This node has been abandoned + if let Some(r) = search.found { + if r.mark_tower() { + self.hot_data.len.fetch_sub(1, Ordering::Relaxed); + } + } break; } diff --git a/crossbeam-skiplist/src/base.rs b/crossbeam-skiplist/src/base.rs --- a/crossbeam-skiplist/src/base.rs +++ b/crossbeam-skiplist/src/base.rs @@ -956,13 +946,7 @@ where if let Some(r) = search.found { let replace = replace(&r.value); - if replace { - // If a node with the key was found and we should replace it, mark its - // tower and then repeat the search. - if r.mark_tower() { - self.hot_data.len.fetch_sub(1, Ordering::Relaxed); - } - } else { + if !replace { // If a node with the key was found and we're not going to replace it, // let's try returning it as an entry. if let Some(e) = RefEntry::try_acquire(self, r) {
crossbeam-rs/crossbeam
1,101
9e8596105bc9a6b343918b6ad1c9656dc24dc4f9
crossbeam-skiplist bug [dependencies] crossbeam-skiplist = "0.1.1" ```rs fn main() { let map: Arc<SkipMap<u32, u32>> = Arc::new(SkipMap::new()); map.insert(1, 2); let map1 = map.clone(); std::thread::spawn(move||{ let key = 1; for _ in 0..10_0000 { let len = map1.len(); if let Some(entry) = map1.get(&key) { }else{ panic!("len={},key={}",len,key); } std::thread::sleep(Duration::from_millis(1)); } }); for _ in 0..10_0000 { map.insert(1, 2); std::thread::sleep(Duration::from_millis(100)); } } ``` output: ``` thread '<unnamed>' panicked at 'len=1,key=1', src\main.rs:21:17 stack backtrace: ```
9e8596105bc9a6b343918b6ad1c9656dc24dc4f9
crossbeam-rs__crossbeam-1045
Hmm, if I understand correctly, there is no way actually to cause this at this time. (That said, we can do this with zero cost using RAII guards that abort on drop.) > Hmm, if I understand correctly, there is no way actually to cause this at this time. At least I hope so. But there is already an [accepted RFC](https://rust-lang.github.io/rfcs/2116-alloc-me-maybe.html) for Rust to change the behaviour of out-of-memory panics to unwinding panics on user request. So when this is implemented (it may already be on nightly, I haven't checked) and hits stable, the current implementation will be unsound. > (That said, we can do this with zero cost using RAII guards that abort on drop.) Ohh, good idea! I should change the code accordingly. Before I start reinventing the wheel: Do you know whether this particular guard is already implemented somewhere? > But there is already an [accepted RFC](https://rust-lang.github.io/rfcs/2116-alloc-me-maybe.html) for Rust to change the behaviour of out-of-memory panics to unwinding panics on user request. So when this is implemented (it may already be on nightly, I haven't checked) and hits stable, the current implementation will be unsound. Oh, you are right. The linked RFC is not implemented yet (https://github.com/rust-lang/rust/issues/43596), but I found that there is an unstable feature that does something similar: https://github.com/rust-lang/rust/issues/51245 > Do you know whether this particular guard is already implemented somewhere? I don't remember if it's already in the crossbeam, but it's so small, so I don't mind duplication. ```rust struct Bomb; impl Drop for Bomb { fn drop(&mut self) { std::process::abort(); } } let bomb = Bomb; // processes that may panic... mem::forget(bomb); ```
2023-12-02T12:21:14Z
0.8
diff --git a/crossbeam-channel/src/lib.rs b/crossbeam-channel/src/lib.rs --- a/crossbeam-channel/src/lib.rs +++ b/crossbeam-channel/src/lib.rs @@ -328,16 +328,11 @@ #![doc(test( no_crate_inject, attr( - deny(warnings, rust_2018_idioms), + deny(warnings, rust_2018_idioms, single_use_lifetimes), allow(dead_code, unused_assignments, unused_variables) ) ))] -#![warn( - missing_docs, - missing_debug_implementations, - rust_2018_idioms, - unreachable_pub -)] +#![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] use cfg_if::cfg_if; diff --git a/crossbeam-channel/tests/golang.rs b/crossbeam-channel/tests/golang.rs --- a/crossbeam-channel/tests/golang.rs +++ b/crossbeam-channel/tests/golang.rs @@ -42,8 +42,8 @@ struct ChanInner<T> { } impl<T> Clone for Chan<T> { - fn clone(&self) -> Chan<T> { - Chan { + fn clone(&self) -> Self { + Self { inner: self.inner.clone(), } } diff --git a/crossbeam-channel/tests/golang.rs b/crossbeam-channel/tests/golang.rs --- a/crossbeam-channel/tests/golang.rs +++ b/crossbeam-channel/tests/golang.rs @@ -123,7 +123,7 @@ impl<T> Iterator for Chan<T> { } } -impl<'a, T> IntoIterator for &'a Chan<T> { +impl<T> IntoIterator for &Chan<T> { type Item = T; type IntoIter = Chan<T>; diff --git a/crossbeam-channel/tests/golang.rs b/crossbeam-channel/tests/golang.rs --- a/crossbeam-channel/tests/golang.rs +++ b/crossbeam-channel/tests/golang.rs @@ -169,8 +169,8 @@ struct WaitGroupInner { } impl WaitGroup { - fn new() -> WaitGroup { - WaitGroup(Arc::new(WaitGroupInner { + fn new() -> Self { + Self(Arc::new(WaitGroupInner { cond: Condvar::new(), count: Mutex::new(0), })) diff --git a/crossbeam-channel/tests/golang.rs b/crossbeam-channel/tests/golang.rs --- a/crossbeam-channel/tests/golang.rs +++ b/crossbeam-channel/tests/golang.rs @@ -1621,7 +1621,7 @@ mod chan { impl ChanWithVals { fn with_capacity(capacity: usize) -> Self { - ChanWithVals { + Self { chan: make(capacity), sv: Arc::new(AtomicI32::new(0)), rv: Arc::new(AtomicI32::new(0)), diff --git a/crossbeam-channel/tests/golang.rs b/crossbeam-channel/tests/golang.rs --- a/crossbeam-channel/tests/golang.rs +++ b/crossbeam-channel/tests/golang.rs @@ -1629,7 +1629,7 @@ mod chan { } fn closed() -> Self { - let ch = ChanWithVals::with_capacity(0); + let ch = Self::with_capacity(0); ch.chan.close_r(); ch.chan.close_s(); ch diff --git a/crossbeam-channel/tests/golang.rs b/crossbeam-channel/tests/golang.rs --- a/crossbeam-channel/tests/golang.rs +++ b/crossbeam-channel/tests/golang.rs @@ -1674,7 +1674,7 @@ mod chan { impl Clone for ChanWithVals { fn clone(&self) -> Self { - ChanWithVals { + Self { chan: self.chan.clone(), sv: self.sv.clone(), rv: self.rv.clone(), diff --git a/crossbeam-channel/tests/golang.rs b/crossbeam-channel/tests/golang.rs --- a/crossbeam-channel/tests/golang.rs +++ b/crossbeam-channel/tests/golang.rs @@ -1702,7 +1702,7 @@ mod chan { impl Clone for Context { fn clone(&self) -> Self { - Context { + Self { nproc: self.nproc.clone(), cval: self.cval.clone(), tot: self.tot.clone(), diff --git a/crossbeam-channel/tests/mpsc.rs b/crossbeam-channel/tests/mpsc.rs --- a/crossbeam-channel/tests/mpsc.rs +++ b/crossbeam-channel/tests/mpsc.rs @@ -29,34 +29,34 @@ use std::time::Duration; use crossbeam_channel as cc; -pub struct Sender<T> { - pub inner: cc::Sender<T>, +struct Sender<T> { + inner: cc::Sender<T>, } impl<T> Sender<T> { - pub fn send(&self, t: T) -> Result<(), SendError<T>> { + fn send(&self, t: T) -> Result<(), SendError<T>> { self.inner.send(t).map_err(|cc::SendError(m)| SendError(m)) } } impl<T> Clone for Sender<T> { - fn clone(&self) -> Sender<T> { - Sender { + fn clone(&self) -> Self { + Self { inner: self.inner.clone(), } } } -pub struct SyncSender<T> { - pub inner: cc::Sender<T>, +struct SyncSender<T> { + inner: cc::Sender<T>, } impl<T> SyncSender<T> { - pub fn send(&self, t: T) -> Result<(), SendError<T>> { + fn send(&self, t: T) -> Result<(), SendError<T>> { self.inner.send(t).map_err(|cc::SendError(m)| SendError(m)) } - pub fn try_send(&self, t: T) -> Result<(), TrySendError<T>> { + fn try_send(&self, t: T) -> Result<(), TrySendError<T>> { self.inner.try_send(t).map_err(|err| match err { cc::TrySendError::Full(m) => TrySendError::Full(m), cc::TrySendError::Disconnected(m) => TrySendError::Disconnected(m), diff --git a/crossbeam-channel/tests/mpsc.rs b/crossbeam-channel/tests/mpsc.rs --- a/crossbeam-channel/tests/mpsc.rs +++ b/crossbeam-channel/tests/mpsc.rs @@ -65,41 +65,41 @@ impl<T> SyncSender<T> { } impl<T> Clone for SyncSender<T> { - fn clone(&self) -> SyncSender<T> { - SyncSender { + fn clone(&self) -> Self { + Self { inner: self.inner.clone(), } } } -pub struct Receiver<T> { - pub inner: cc::Receiver<T>, +struct Receiver<T> { + inner: cc::Receiver<T>, } impl<T> Receiver<T> { - pub fn try_recv(&self) -> Result<T, TryRecvError> { + fn try_recv(&self) -> Result<T, TryRecvError> { self.inner.try_recv().map_err(|err| match err { cc::TryRecvError::Empty => TryRecvError::Empty, cc::TryRecvError::Disconnected => TryRecvError::Disconnected, }) } - pub fn recv(&self) -> Result<T, RecvError> { + fn recv(&self) -> Result<T, RecvError> { self.inner.recv().map_err(|_| RecvError) } - pub fn recv_timeout(&self, timeout: Duration) -> Result<T, RecvTimeoutError> { + fn recv_timeout(&self, timeout: Duration) -> Result<T, RecvTimeoutError> { self.inner.recv_timeout(timeout).map_err(|err| match err { cc::RecvTimeoutError::Timeout => RecvTimeoutError::Timeout, cc::RecvTimeoutError::Disconnected => RecvTimeoutError::Disconnected, }) } - pub fn iter(&self) -> Iter<T> { + fn iter(&self) -> Iter<'_, T> { Iter { inner: self } } - pub fn try_iter(&self) -> TryIter<T> { + fn try_iter(&self) -> TryIter<'_, T> { TryIter { inner: self } } } diff --git a/crossbeam-channel/tests/mpsc.rs b/crossbeam-channel/tests/mpsc.rs --- a/crossbeam-channel/tests/mpsc.rs +++ b/crossbeam-channel/tests/mpsc.rs @@ -122,11 +122,11 @@ impl<T> IntoIterator for Receiver<T> { } } -pub struct TryIter<'a, T: 'a> { +struct TryIter<'a, T> { inner: &'a Receiver<T>, } -impl<'a, T> Iterator for TryIter<'a, T> { +impl<T> Iterator for TryIter<'_, T> { type Item = T; fn next(&mut self) -> Option<T> { diff --git a/crossbeam-channel/tests/mpsc.rs b/crossbeam-channel/tests/mpsc.rs --- a/crossbeam-channel/tests/mpsc.rs +++ b/crossbeam-channel/tests/mpsc.rs @@ -134,11 +134,11 @@ impl<'a, T> Iterator for TryIter<'a, T> { } } -pub struct Iter<'a, T: 'a> { +struct Iter<'a, T> { inner: &'a Receiver<T>, } -impl<'a, T> Iterator for Iter<'a, T> { +impl<T> Iterator for Iter<'_, T> { type Item = T; fn next(&mut self) -> Option<T> { diff --git a/crossbeam-channel/tests/mpsc.rs b/crossbeam-channel/tests/mpsc.rs --- a/crossbeam-channel/tests/mpsc.rs +++ b/crossbeam-channel/tests/mpsc.rs @@ -146,7 +146,7 @@ impl<'a, T> Iterator for Iter<'a, T> { } } -pub struct IntoIter<T> { +struct IntoIter<T> { inner: Receiver<T>, } diff --git a/crossbeam-channel/tests/mpsc.rs b/crossbeam-channel/tests/mpsc.rs --- a/crossbeam-channel/tests/mpsc.rs +++ b/crossbeam-channel/tests/mpsc.rs @@ -158,14 +158,14 @@ impl<T> Iterator for IntoIter<T> { } } -pub fn channel<T>() -> (Sender<T>, Receiver<T>) { +fn channel<T>() -> (Sender<T>, Receiver<T>) { let (s, r) = cc::unbounded(); let s = Sender { inner: s }; let r = Receiver { inner: r }; (s, r) } -pub fn sync_channel<T>(bound: usize) -> (SyncSender<T>, Receiver<T>) { +fn sync_channel<T>(bound: usize) -> (SyncSender<T>, Receiver<T>) { let (s, r) = cc::bounded(bound); let s = SyncSender { inner: s }; let r = Receiver { inner: r }; diff --git a/crossbeam-channel/tests/mpsc.rs b/crossbeam-channel/tests/mpsc.rs --- a/crossbeam-channel/tests/mpsc.rs +++ b/crossbeam-channel/tests/mpsc.rs @@ -195,7 +195,7 @@ mod channel_tests { use std::thread; use std::time::{Duration, Instant}; - pub fn stress_factor() -> usize { + fn stress_factor() -> usize { match env::var("RUST_TEST_STRESS") { Ok(val) => val.parse().unwrap(), Err(..) => 1, diff --git a/crossbeam-channel/tests/mpsc.rs b/crossbeam-channel/tests/mpsc.rs --- a/crossbeam-channel/tests/mpsc.rs +++ b/crossbeam-channel/tests/mpsc.rs @@ -971,7 +971,7 @@ mod sync_channel_tests { use std::thread; use std::time::Duration; - pub fn stress_factor() -> usize { + fn stress_factor() -> usize { match env::var("RUST_TEST_STRESS") { Ok(val) => val.parse().unwrap(), Err(..) => 1, diff --git a/crossbeam-deque/src/lib.rs b/crossbeam-deque/src/lib.rs --- a/crossbeam-deque/src/lib.rs +++ b/crossbeam-deque/src/lib.rs @@ -85,16 +85,11 @@ #![doc(test( no_crate_inject, attr( - deny(warnings, rust_2018_idioms), + deny(warnings, rust_2018_idioms, single_use_lifetimes), allow(dead_code, unused_assignments, unused_variables) ) ))] -#![warn( - missing_docs, - missing_debug_implementations, - rust_2018_idioms, - unreachable_pub -)] +#![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] use cfg_if::cfg_if; diff --git a/crossbeam-epoch/Cargo.toml b/crossbeam-epoch/Cargo.toml --- a/crossbeam-epoch/Cargo.toml +++ b/crossbeam-epoch/Cargo.toml @@ -39,7 +39,6 @@ autocfg = "1" [dependencies] cfg-if = "1" memoffset = "0.9" -scopeguard = { version = "1.1", default-features = false } # Enable the use of loom for concurrency testing. # diff --git a/crossbeam-epoch/src/lib.rs b/crossbeam-epoch/src/lib.rs --- a/crossbeam-epoch/src/lib.rs +++ b/crossbeam-epoch/src/lib.rs @@ -51,16 +51,11 @@ #![doc(test( no_crate_inject, attr( - deny(warnings, rust_2018_idioms), + deny(warnings, rust_2018_idioms, single_use_lifetimes), allow(dead_code, unused_assignments, unused_variables) ) ))] -#![warn( - missing_docs, - missing_debug_implementations, - rust_2018_idioms, - unreachable_pub -)] +#![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] #[cfg(crossbeam_loom)] diff --git a/crossbeam-epoch/src/sync/list.rs b/crossbeam-epoch/src/sync/list.rs --- a/crossbeam-epoch/src/sync/list.rs +++ b/crossbeam-epoch/src/sync/list.rs @@ -302,12 +302,12 @@ mod tests { use crossbeam_utils::thread; use std::sync::Barrier; - impl IsElement<Entry> for Entry { - fn entry_of(entry: &Entry) -> &Entry { + impl IsElement<Self> for Entry { + fn entry_of(entry: &Self) -> &Entry { entry } - unsafe fn element_of(entry: &Entry) -> &Entry { + unsafe fn element_of(entry: &Entry) -> &Self { entry } diff --git a/crossbeam-epoch/src/sync/queue.rs b/crossbeam-epoch/src/sync/queue.rs --- a/crossbeam-epoch/src/sync/queue.rs +++ b/crossbeam-epoch/src/sync/queue.rs @@ -226,8 +226,8 @@ mod test { } impl<T> Queue<T> { - pub(crate) fn new() -> Queue<T> { - Queue { + pub(crate) fn new() -> Self { + Self { queue: super::Queue::new(), } } diff --git a/crossbeam-epoch/tests/loom.rs b/crossbeam-epoch/tests/loom.rs --- a/crossbeam-epoch/tests/loom.rs +++ b/crossbeam-epoch/tests/loom.rs @@ -51,7 +51,7 @@ fn treiber_stack() { /// /// Usable with any number of producers and consumers. #[derive(Debug)] - pub struct TreiberStack<T> { + struct TreiberStack<T> { head: Atomic<Node<T>>, } diff --git a/crossbeam-epoch/tests/loom.rs b/crossbeam-epoch/tests/loom.rs --- a/crossbeam-epoch/tests/loom.rs +++ b/crossbeam-epoch/tests/loom.rs @@ -63,14 +63,14 @@ fn treiber_stack() { impl<T> TreiberStack<T> { /// Creates a new, empty stack. - pub fn new() -> TreiberStack<T> { - TreiberStack { + fn new() -> Self { + Self { head: Atomic::null(), } } /// Pushes a value on top of the stack. - pub fn push(&self, t: T) { + fn push(&self, t: T) { let mut n = Owned::new(Node { data: ManuallyDrop::new(t), next: Atomic::null(), diff --git a/crossbeam-epoch/tests/loom.rs b/crossbeam-epoch/tests/loom.rs --- a/crossbeam-epoch/tests/loom.rs +++ b/crossbeam-epoch/tests/loom.rs @@ -95,7 +95,7 @@ fn treiber_stack() { /// Attempts to pop the top element from the stack. /// /// Returns `None` if the stack is empty. - pub fn pop(&self) -> Option<T> { + fn pop(&self) -> Option<T> { let guard = epoch::pin(); loop { let head = self.head.load(Acquire, &guard); diff --git a/crossbeam-epoch/tests/loom.rs b/crossbeam-epoch/tests/loom.rs --- a/crossbeam-epoch/tests/loom.rs +++ b/crossbeam-epoch/tests/loom.rs @@ -121,7 +121,7 @@ fn treiber_stack() { } /// Returns `true` if the stack is empty. - pub fn is_empty(&self) -> bool { + fn is_empty(&self) -> bool { let guard = epoch::pin(); self.head.load(Acquire, &guard).is_null() } diff --git a/crossbeam-queue/src/lib.rs b/crossbeam-queue/src/lib.rs --- a/crossbeam-queue/src/lib.rs +++ b/crossbeam-queue/src/lib.rs @@ -8,16 +8,11 @@ #![doc(test( no_crate_inject, attr( - deny(warnings, rust_2018_idioms), + deny(warnings, rust_2018_idioms, single_use_lifetimes), allow(dead_code, unused_assignments, unused_variables) ) ))] -#![warn( - missing_docs, - missing_debug_implementations, - rust_2018_idioms, - unreachable_pub -)] +#![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] #[cfg(target_has_atomic = "ptr")] diff --git a/crossbeam-skiplist/src/lib.rs b/crossbeam-skiplist/src/lib.rs --- a/crossbeam-skiplist/src/lib.rs +++ b/crossbeam-skiplist/src/lib.rs @@ -231,16 +231,11 @@ #![doc(test( no_crate_inject, attr( - deny(warnings, rust_2018_idioms), + deny(warnings, rust_2018_idioms, single_use_lifetimes), allow(dead_code, unused_assignments, unused_variables) ) ))] -#![warn( - missing_docs, - missing_debug_implementations, - rust_2018_idioms, - unreachable_pub -)] +#![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] use cfg_if::cfg_if; diff --git a/crossbeam-utils/src/lib.rs b/crossbeam-utils/src/lib.rs --- a/crossbeam-utils/src/lib.rs +++ b/crossbeam-utils/src/lib.rs @@ -27,16 +27,11 @@ #![doc(test( no_crate_inject, attr( - deny(warnings, rust_2018_idioms), + deny(warnings, rust_2018_idioms, single_use_lifetimes), allow(dead_code, unused_assignments, unused_variables) ) ))] -#![warn( - missing_docs, - missing_debug_implementations, - rust_2018_idioms, - unreachable_pub -)] +#![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] #[cfg(crossbeam_loom)] diff --git a/crossbeam-utils/tests/atomic_cell.rs b/crossbeam-utils/tests/atomic_cell.rs --- a/crossbeam-utils/tests/atomic_cell.rs +++ b/crossbeam-utils/tests/atomic_cell.rs @@ -63,9 +63,9 @@ fn drops_unit() { struct Foo(); impl Foo { - fn new() -> Foo { + fn new() -> Self { CNT.fetch_add(1, SeqCst); - Foo() + Self() } } diff --git a/crossbeam-utils/tests/atomic_cell.rs b/crossbeam-utils/tests/atomic_cell.rs --- a/crossbeam-utils/tests/atomic_cell.rs +++ b/crossbeam-utils/tests/atomic_cell.rs @@ -76,8 +76,8 @@ fn drops_unit() { } impl Default for Foo { - fn default() -> Foo { - Foo::new() + fn default() -> Self { + Self::new() } } diff --git a/crossbeam-utils/tests/atomic_cell.rs b/crossbeam-utils/tests/atomic_cell.rs --- a/crossbeam-utils/tests/atomic_cell.rs +++ b/crossbeam-utils/tests/atomic_cell.rs @@ -105,9 +105,9 @@ fn drops_u8() { struct Foo(u8); impl Foo { - fn new(val: u8) -> Foo { + fn new(val: u8) -> Self { CNT.fetch_add(1, SeqCst); - Foo(val) + Self(val) } } diff --git a/crossbeam-utils/tests/atomic_cell.rs b/crossbeam-utils/tests/atomic_cell.rs --- a/crossbeam-utils/tests/atomic_cell.rs +++ b/crossbeam-utils/tests/atomic_cell.rs @@ -118,8 +118,8 @@ fn drops_u8() { } impl Default for Foo { - fn default() -> Foo { - Foo::new(0) + fn default() -> Self { + Self::new(0) } } diff --git a/crossbeam-utils/tests/atomic_cell.rs b/crossbeam-utils/tests/atomic_cell.rs --- a/crossbeam-utils/tests/atomic_cell.rs +++ b/crossbeam-utils/tests/atomic_cell.rs @@ -151,9 +151,9 @@ fn drops_usize() { struct Foo(usize); impl Foo { - fn new(val: usize) -> Foo { + fn new(val: usize) -> Self { CNT.fetch_add(1, SeqCst); - Foo(val) + Self(val) } } diff --git a/crossbeam-utils/tests/atomic_cell.rs b/crossbeam-utils/tests/atomic_cell.rs --- a/crossbeam-utils/tests/atomic_cell.rs +++ b/crossbeam-utils/tests/atomic_cell.rs @@ -164,8 +164,8 @@ fn drops_usize() { } impl Default for Foo { - fn default() -> Foo { - Foo::new(0) + fn default() -> Self { + Self::new(0) } } diff --git a/crossbeam-utils/tests/atomic_cell.rs b/crossbeam-utils/tests/atomic_cell.rs --- a/crossbeam-utils/tests/atomic_cell.rs +++ b/crossbeam-utils/tests/atomic_cell.rs @@ -194,7 +194,7 @@ fn modular_u8() { struct Foo(u8); impl PartialEq for Foo { - fn eq(&self, other: &Foo) -> bool { + fn eq(&self, other: &Self) -> bool { self.0 % 5 == other.0 % 5 } } diff --git a/crossbeam-utils/tests/atomic_cell.rs b/crossbeam-utils/tests/atomic_cell.rs --- a/crossbeam-utils/tests/atomic_cell.rs +++ b/crossbeam-utils/tests/atomic_cell.rs @@ -218,7 +218,7 @@ fn modular_usize() { struct Foo(usize); impl PartialEq for Foo { - fn eq(&self, other: &Foo) -> bool { + fn eq(&self, other: &Self) -> bool { self.0 % 5 == other.0 % 5 } } diff --git a/crossbeam-utils/tests/cache_padded.rs b/crossbeam-utils/tests/cache_padded.rs --- a/crossbeam-utils/tests/cache_padded.rs +++ b/crossbeam-utils/tests/cache_padded.rs @@ -69,7 +69,7 @@ fn drops() { struct Foo<'a>(&'a Cell<usize>); - impl<'a> Drop for Foo<'a> { + impl Drop for Foo<'_> { fn drop(&mut self) { self.0.set(self.0.get() + 1); } diff --git a/crossbeam-utils/tests/cache_padded.rs b/crossbeam-utils/tests/cache_padded.rs --- a/crossbeam-utils/tests/cache_padded.rs +++ b/crossbeam-utils/tests/cache_padded.rs @@ -99,10 +99,10 @@ fn runs_custom_clone() { struct Foo<'a>(&'a Cell<usize>); - impl<'a> Clone for Foo<'a> { - fn clone(&self) -> Foo<'a> { + impl Clone for Foo<'_> { + fn clone(&self) -> Self { self.0.set(self.0.get() + 1); - Foo::<'a>(self.0) + Self(self.0) } } diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -41,16 +41,11 @@ #![doc(test( no_crate_inject, attr( - deny(warnings, rust_2018_idioms), + deny(warnings, rust_2018_idioms, single_use_lifetimes), allow(dead_code, unused_assignments, unused_variables) ) ))] -#![warn( - missing_docs, - missing_debug_implementations, - rust_2018_idioms, - unreachable_pub -)] +#![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] pub use crossbeam_utils::atomic;
[ "724" ]
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ name = "crossbeam" # - Update README.md # - Create "crossbeam-X.Y.Z" git tag version = "0.8.2" -edition = "2018" +edition = "2021" rust-version = "1.61" license = "MIT OR Apache-2.0" repository = "https://github.com/crossbeam-rs/crossbeam" diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,11 @@ default-features = false [dev-dependencies] rand = "0.8" +[lints] +workspace = true + [workspace] +resolver = "2" members = [ ".", "crossbeam-channel", diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -79,3 +83,9 @@ members = [ "crossbeam-skiplist", "crossbeam-utils", ] + +[workspace.lints.rust] +missing_debug_implementations = "warn" +rust_2018_idioms = "warn" +single_use_lifetimes = "warn" +unreachable_pub = "warn" diff --git a/crossbeam-channel/Cargo.toml b/crossbeam-channel/Cargo.toml --- a/crossbeam-channel/Cargo.toml +++ b/crossbeam-channel/Cargo.toml @@ -5,7 +5,7 @@ name = "crossbeam-channel" # - Update README.md # - Create "crossbeam-channel-X.Y.Z" git tag version = "0.5.8" -edition = "2018" +edition = "2021" rust-version = "1.61" license = "MIT OR Apache-2.0" repository = "https://github.com/crossbeam-rs/crossbeam" diff --git a/crossbeam-channel/Cargo.toml b/crossbeam-channel/Cargo.toml --- a/crossbeam-channel/Cargo.toml +++ b/crossbeam-channel/Cargo.toml @@ -36,3 +36,6 @@ optional = true num_cpus = "1.13.0" rand = "0.8" signal-hook = "0.3" + +[lints] +workspace = true diff --git a/crossbeam-channel/benchmarks/Cargo.toml b/crossbeam-channel/benchmarks/Cargo.toml --- a/crossbeam-channel/benchmarks/Cargo.toml +++ b/crossbeam-channel/benchmarks/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "benchmarks" version = "0.1.0" -edition = "2018" +edition = "2021" publish = false [dependencies] diff --git a/crossbeam-channel/benchmarks/Cargo.toml b/crossbeam-channel/benchmarks/Cargo.toml --- a/crossbeam-channel/benchmarks/Cargo.toml +++ b/crossbeam-channel/benchmarks/Cargo.toml @@ -69,3 +69,6 @@ doc = false name = "mpmc" path = "mpmc.rs" doc = false + +[lints] +workspace = true diff --git a/crossbeam-channel/benchmarks/message.rs b/crossbeam-channel/benchmarks/message.rs --- a/crossbeam-channel/benchmarks/message.rs +++ b/crossbeam-channel/benchmarks/message.rs @@ -3,7 +3,7 @@ use std::fmt; const LEN: usize = 1; #[derive(Clone, Copy)] -pub struct Message(pub [usize; LEN]); +pub(crate) struct Message(pub(crate) [usize; LEN]); impl fmt::Debug for Message { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/crossbeam-channel/benchmarks/message.rs b/crossbeam-channel/benchmarks/message.rs --- a/crossbeam-channel/benchmarks/message.rs +++ b/crossbeam-channel/benchmarks/message.rs @@ -12,6 +12,6 @@ impl fmt::Debug for Message { } #[inline] -pub fn new(num: usize) -> Message { +pub(crate) fn new(num: usize) -> Message { Message([num; LEN]) } diff --git a/crossbeam-channel/src/channel.rs b/crossbeam-channel/src/channel.rs --- a/crossbeam-channel/src/channel.rs +++ b/crossbeam-channel/src/channel.rs @@ -648,7 +648,7 @@ impl<T> Sender<T> { /// let (s3, _) = unbounded(); /// assert!(!s.same_channel(&s3)); /// ``` - pub fn same_channel(&self, other: &Sender<T>) -> bool { + pub fn same_channel(&self, other: &Self) -> bool { match (&self.flavor, &other.flavor) { (SenderFlavor::Array(ref a), SenderFlavor::Array(ref b)) => a == b, (SenderFlavor::List(ref a), SenderFlavor::List(ref b)) => a == b, diff --git a/crossbeam-channel/src/channel.rs b/crossbeam-channel/src/channel.rs --- a/crossbeam-channel/src/channel.rs +++ b/crossbeam-channel/src/channel.rs @@ -678,7 +678,7 @@ impl<T> Clone for Sender<T> { SenderFlavor::Zero(chan) => SenderFlavor::Zero(chan.acquire()), }; - Sender { flavor } + Self { flavor } } } diff --git a/crossbeam-channel/src/channel.rs b/crossbeam-channel/src/channel.rs --- a/crossbeam-channel/src/channel.rs +++ b/crossbeam-channel/src/channel.rs @@ -1142,7 +1142,7 @@ impl<T> Receiver<T> { /// let (_, r3) = unbounded(); /// assert!(!r.same_channel(&r3)); /// ``` - pub fn same_channel(&self, other: &Receiver<T>) -> bool { + pub fn same_channel(&self, other: &Self) -> bool { match (&self.flavor, &other.flavor) { (ReceiverFlavor::Array(a), ReceiverFlavor::Array(b)) => a == b, (ReceiverFlavor::List(a), ReceiverFlavor::List(b)) => a == b, diff --git a/crossbeam-channel/src/channel.rs b/crossbeam-channel/src/channel.rs --- a/crossbeam-channel/src/channel.rs +++ b/crossbeam-channel/src/channel.rs @@ -1181,7 +1181,7 @@ impl<T> Clone for Receiver<T> { ReceiverFlavor::Never(_) => ReceiverFlavor::Never(flavors::never::Channel::new()), }; - Receiver { flavor } + Self { flavor } } } diff --git a/crossbeam-channel/src/context.rs b/crossbeam-channel/src/context.rs --- a/crossbeam-channel/src/context.rs +++ b/crossbeam-channel/src/context.rs @@ -39,7 +39,7 @@ impl Context { #[inline] pub fn with<F, R>(f: F) -> R where - F: FnOnce(&Context) -> R, + F: FnOnce(&Self) -> R, { thread_local! { /// Cached thread-local context. diff --git a/crossbeam-channel/src/context.rs b/crossbeam-channel/src/context.rs --- a/crossbeam-channel/src/context.rs +++ b/crossbeam-channel/src/context.rs @@ -47,14 +47,14 @@ impl Context { } let mut f = Some(f); - let mut f = |cx: &Context| -> R { + let mut f = |cx: &Self| -> R { let f = f.take().unwrap(); f(cx) }; CONTEXT .try_with(|cell| match cell.take() { - None => f(&Context::new()), + None => f(&Self::new()), Some(cx) => { cx.reset(); let res = f(&cx); diff --git a/crossbeam-channel/src/context.rs b/crossbeam-channel/src/context.rs --- a/crossbeam-channel/src/context.rs +++ b/crossbeam-channel/src/context.rs @@ -62,13 +62,13 @@ impl Context { res } }) - .unwrap_or_else(|_| f(&Context::new())) + .unwrap_or_else(|_| f(&Self::new())) } /// Creates a new `Context`. #[cold] - fn new() -> Context { - Context { + fn new() -> Self { + Self { inner: Arc::new(Inner { select: AtomicUsize::new(Selected::Waiting.into()), packet: AtomicPtr::new(ptr::null_mut()), diff --git a/crossbeam-channel/src/counter.rs b/crossbeam-channel/src/counter.rs --- a/crossbeam-channel/src/counter.rs +++ b/crossbeam-channel/src/counter.rs @@ -45,7 +45,7 @@ impl<C> Sender<C> { } /// Acquires another sender reference. - pub(crate) fn acquire(&self) -> Sender<C> { + pub(crate) fn acquire(&self) -> Self { let count = self.counter().senders.fetch_add(1, Ordering::Relaxed); // Cloning senders and calling `mem::forget` on the clones could potentially overflow the diff --git a/crossbeam-channel/src/counter.rs b/crossbeam-channel/src/counter.rs --- a/crossbeam-channel/src/counter.rs +++ b/crossbeam-channel/src/counter.rs @@ -55,7 +55,7 @@ impl<C> Sender<C> { process::abort(); } - Sender { + Self { counter: self.counter, } } diff --git a/crossbeam-channel/src/counter.rs b/crossbeam-channel/src/counter.rs --- a/crossbeam-channel/src/counter.rs +++ b/crossbeam-channel/src/counter.rs @@ -83,7 +83,7 @@ impl<C> ops::Deref for Sender<C> { } impl<C> PartialEq for Sender<C> { - fn eq(&self, other: &Sender<C>) -> bool { + fn eq(&self, other: &Self) -> bool { self.counter == other.counter } } diff --git a/crossbeam-channel/src/counter.rs b/crossbeam-channel/src/counter.rs --- a/crossbeam-channel/src/counter.rs +++ b/crossbeam-channel/src/counter.rs @@ -100,7 +100,7 @@ impl<C> Receiver<C> { } /// Acquires another receiver reference. - pub(crate) fn acquire(&self) -> Receiver<C> { + pub(crate) fn acquire(&self) -> Self { let count = self.counter().receivers.fetch_add(1, Ordering::Relaxed); // Cloning receivers and calling `mem::forget` on the clones could potentially overflow the diff --git a/crossbeam-channel/src/counter.rs b/crossbeam-channel/src/counter.rs --- a/crossbeam-channel/src/counter.rs +++ b/crossbeam-channel/src/counter.rs @@ -110,7 +110,7 @@ impl<C> Receiver<C> { process::abort(); } - Receiver { + Self { counter: self.counter, } } diff --git a/crossbeam-channel/src/counter.rs b/crossbeam-channel/src/counter.rs --- a/crossbeam-channel/src/counter.rs +++ b/crossbeam-channel/src/counter.rs @@ -138,7 +138,7 @@ impl<C> ops::Deref for Receiver<C> { } impl<C> PartialEq for Receiver<C> { - fn eq(&self, other: &Receiver<C>) -> bool { + fn eq(&self, other: &Self) -> bool { self.counter == other.counter } } diff --git a/crossbeam-channel/src/err.rs b/crossbeam-channel/src/err.rs --- a/crossbeam-channel/src/err.rs +++ b/crossbeam-channel/src/err.rs @@ -152,8 +152,8 @@ impl<T> SendError<T> { impl<T> fmt::Debug for TrySendError<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { - TrySendError::Full(..) => "Full(..)".fmt(f), - TrySendError::Disconnected(..) => "Disconnected(..)".fmt(f), + Self::Full(..) => "Full(..)".fmt(f), + Self::Disconnected(..) => "Disconnected(..)".fmt(f), } } } diff --git a/crossbeam-channel/src/err.rs b/crossbeam-channel/src/err.rs --- a/crossbeam-channel/src/err.rs +++ b/crossbeam-channel/src/err.rs @@ -161,8 +161,8 @@ impl<T> fmt::Debug for TrySendError<T> { impl<T> fmt::Display for TrySendError<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { - TrySendError::Full(..) => "sending on a full channel".fmt(f), - TrySendError::Disconnected(..) => "sending on a disconnected channel".fmt(f), + Self::Full(..) => "sending on a full channel".fmt(f), + Self::Disconnected(..) => "sending on a disconnected channel".fmt(f), } } } diff --git a/crossbeam-channel/src/err.rs b/crossbeam-channel/src/err.rs --- a/crossbeam-channel/src/err.rs +++ b/crossbeam-channel/src/err.rs @@ -170,9 +170,9 @@ impl<T> fmt::Display for TrySendError<T> { impl<T: Send> error::Error for TrySendError<T> {} impl<T> From<SendError<T>> for TrySendError<T> { - fn from(err: SendError<T>) -> TrySendError<T> { + fn from(err: SendError<T>) -> Self { match err { - SendError(t) => TrySendError::Disconnected(t), + SendError(t) => Self::Disconnected(t), } } } diff --git a/crossbeam-channel/src/err.rs b/crossbeam-channel/src/err.rs --- a/crossbeam-channel/src/err.rs +++ b/crossbeam-channel/src/err.rs @@ -193,19 +193,19 @@ impl<T> TrySendError<T> { /// ``` pub fn into_inner(self) -> T { match self { - TrySendError::Full(v) => v, - TrySendError::Disconnected(v) => v, + Self::Full(v) => v, + Self::Disconnected(v) => v, } } /// Returns `true` if the send operation failed because the channel is full. pub fn is_full(&self) -> bool { - matches!(self, TrySendError::Full(_)) + matches!(self, Self::Full(_)) } /// Returns `true` if the send operation failed because the channel is disconnected. pub fn is_disconnected(&self) -> bool { - matches!(self, TrySendError::Disconnected(_)) + matches!(self, Self::Disconnected(_)) } } diff --git a/crossbeam-channel/src/err.rs b/crossbeam-channel/src/err.rs --- a/crossbeam-channel/src/err.rs +++ b/crossbeam-channel/src/err.rs @@ -218,8 +218,8 @@ impl<T> fmt::Debug for SendTimeoutError<T> { impl<T> fmt::Display for SendTimeoutError<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { - SendTimeoutError::Timeout(..) => "timed out waiting on send operation".fmt(f), - SendTimeoutError::Disconnected(..) => "sending on a disconnected channel".fmt(f), + Self::Timeout(..) => "timed out waiting on send operation".fmt(f), + Self::Disconnected(..) => "sending on a disconnected channel".fmt(f), } } } diff --git a/crossbeam-channel/src/err.rs b/crossbeam-channel/src/err.rs --- a/crossbeam-channel/src/err.rs +++ b/crossbeam-channel/src/err.rs @@ -227,9 +227,9 @@ impl<T> fmt::Display for SendTimeoutError<T> { impl<T: Send> error::Error for SendTimeoutError<T> {} impl<T> From<SendError<T>> for SendTimeoutError<T> { - fn from(err: SendError<T>) -> SendTimeoutError<T> { + fn from(err: SendError<T>) -> Self { match err { - SendError(e) => SendTimeoutError::Disconnected(e), + SendError(e) => Self::Disconnected(e), } } } diff --git a/crossbeam-channel/src/err.rs b/crossbeam-channel/src/err.rs --- a/crossbeam-channel/src/err.rs +++ b/crossbeam-channel/src/err.rs @@ -251,19 +251,19 @@ impl<T> SendTimeoutError<T> { /// ``` pub fn into_inner(self) -> T { match self { - SendTimeoutError::Timeout(v) => v, - SendTimeoutError::Disconnected(v) => v, + Self::Timeout(v) => v, + Self::Disconnected(v) => v, } } /// Returns `true` if the send operation timed out. pub fn is_timeout(&self) -> bool { - matches!(self, SendTimeoutError::Timeout(_)) + matches!(self, Self::Timeout(_)) } /// Returns `true` if the send operation failed because the channel is disconnected. pub fn is_disconnected(&self) -> bool { - matches!(self, SendTimeoutError::Disconnected(_)) + matches!(self, Self::Disconnected(_)) } } diff --git a/crossbeam-channel/src/err.rs b/crossbeam-channel/src/err.rs --- a/crossbeam-channel/src/err.rs +++ b/crossbeam-channel/src/err.rs @@ -278,8 +278,8 @@ impl error::Error for RecvError {} impl fmt::Display for TryRecvError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { - TryRecvError::Empty => "receiving on an empty channel".fmt(f), - TryRecvError::Disconnected => "receiving on an empty and disconnected channel".fmt(f), + Self::Empty => "receiving on an empty channel".fmt(f), + Self::Disconnected => "receiving on an empty and disconnected channel".fmt(f), } } } diff --git a/crossbeam-channel/src/err.rs b/crossbeam-channel/src/err.rs --- a/crossbeam-channel/src/err.rs +++ b/crossbeam-channel/src/err.rs @@ -287,9 +287,9 @@ impl fmt::Display for TryRecvError { impl error::Error for TryRecvError {} impl From<RecvError> for TryRecvError { - fn from(err: RecvError) -> TryRecvError { + fn from(err: RecvError) -> Self { match err { - RecvError => TryRecvError::Disconnected, + RecvError => Self::Disconnected, } } } diff --git a/crossbeam-channel/src/err.rs b/crossbeam-channel/src/err.rs --- a/crossbeam-channel/src/err.rs +++ b/crossbeam-channel/src/err.rs @@ -297,20 +297,20 @@ impl From<RecvError> for TryRecvError { impl TryRecvError { /// Returns `true` if the receive operation failed because the channel is empty. pub fn is_empty(&self) -> bool { - matches!(self, TryRecvError::Empty) + matches!(self, Self::Empty) } /// Returns `true` if the receive operation failed because the channel is disconnected. pub fn is_disconnected(&self) -> bool { - matches!(self, TryRecvError::Disconnected) + matches!(self, Self::Disconnected) } } impl fmt::Display for RecvTimeoutError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { - RecvTimeoutError::Timeout => "timed out waiting on receive operation".fmt(f), - RecvTimeoutError::Disconnected => "channel is empty and disconnected".fmt(f), + Self::Timeout => "timed out waiting on receive operation".fmt(f), + Self::Disconnected => "channel is empty and disconnected".fmt(f), } } } diff --git a/crossbeam-channel/src/err.rs b/crossbeam-channel/src/err.rs --- a/crossbeam-channel/src/err.rs +++ b/crossbeam-channel/src/err.rs @@ -318,9 +318,9 @@ impl fmt::Display for RecvTimeoutError { impl error::Error for RecvTimeoutError {} impl From<RecvError> for RecvTimeoutError { - fn from(err: RecvError) -> RecvTimeoutError { + fn from(err: RecvError) -> Self { match err { - RecvError => RecvTimeoutError::Disconnected, + RecvError => Self::Disconnected, } } } diff --git a/crossbeam-channel/src/err.rs b/crossbeam-channel/src/err.rs --- a/crossbeam-channel/src/err.rs +++ b/crossbeam-channel/src/err.rs @@ -328,12 +328,12 @@ impl From<RecvError> for RecvTimeoutError { impl RecvTimeoutError { /// Returns `true` if the receive operation timed out. pub fn is_timeout(&self) -> bool { - matches!(self, RecvTimeoutError::Timeout) + matches!(self, Self::Timeout) } /// Returns `true` if the receive operation failed because the channel is disconnected. pub fn is_disconnected(&self) -> bool { - matches!(self, RecvTimeoutError::Disconnected) + matches!(self, Self::Disconnected) } } diff --git a/crossbeam-channel/src/flavors/array.rs b/crossbeam-channel/src/flavors/array.rs --- a/crossbeam-channel/src/flavors/array.rs +++ b/crossbeam-channel/src/flavors/array.rs @@ -43,7 +43,7 @@ pub(crate) struct ArrayToken { impl Default for ArrayToken { #[inline] fn default() -> Self { - ArrayToken { + Self { slot: ptr::null(), stamp: 0, } diff --git a/crossbeam-channel/src/flavors/array.rs b/crossbeam-channel/src/flavors/array.rs --- a/crossbeam-channel/src/flavors/array.rs +++ b/crossbeam-channel/src/flavors/array.rs @@ -115,7 +115,7 @@ impl<T> Channel<T> { }) .collect(); - Channel { + Self { buffer, cap, one_lap, diff --git a/crossbeam-channel/src/flavors/at.rs b/crossbeam-channel/src/flavors/at.rs --- a/crossbeam-channel/src/flavors/at.rs +++ b/crossbeam-channel/src/flavors/at.rs @@ -27,7 +27,7 @@ impl Channel { /// Creates a channel that delivers a message at a certain instant in time. #[inline] pub(crate) fn new_deadline(when: Instant) -> Self { - Channel { + Self { delivery_time: when, received: AtomicBool::new(false), } diff --git a/crossbeam-channel/src/flavors/list.rs b/crossbeam-channel/src/flavors/list.rs --- a/crossbeam-channel/src/flavors/list.rs +++ b/crossbeam-channel/src/flavors/list.rs @@ -76,7 +76,7 @@ struct Block<T> { impl<T> Block<T> { /// Creates an empty block. - fn new() -> Block<T> { + fn new() -> Self { Self { next: AtomicPtr::new(ptr::null_mut()), slots: [Slot::UNINIT; BLOCK_CAP], diff --git a/crossbeam-channel/src/flavors/list.rs b/crossbeam-channel/src/flavors/list.rs --- a/crossbeam-channel/src/flavors/list.rs +++ b/crossbeam-channel/src/flavors/list.rs @@ -84,7 +84,7 @@ impl<T> Block<T> { } /// Waits until the next pointer is set. - fn wait_next(&self) -> *mut Block<T> { + fn wait_next(&self) -> *mut Self { let backoff = Backoff::new(); loop { let next = self.next.load(Ordering::Acquire); diff --git a/crossbeam-channel/src/flavors/list.rs b/crossbeam-channel/src/flavors/list.rs --- a/crossbeam-channel/src/flavors/list.rs +++ b/crossbeam-channel/src/flavors/list.rs @@ -96,7 +96,7 @@ impl<T> Block<T> { } /// Sets the `DESTROY` bit in slots starting from `start` and destroys the block. - unsafe fn destroy(this: *mut Block<T>, start: usize) { + unsafe fn destroy(this: *mut Self, start: usize) { // It is not necessary to set the `DESTROY` bit in the last slot because that slot has // begun destruction of the block. for i in start..BLOCK_CAP - 1 { diff --git a/crossbeam-channel/src/flavors/list.rs b/crossbeam-channel/src/flavors/list.rs --- a/crossbeam-channel/src/flavors/list.rs +++ b/crossbeam-channel/src/flavors/list.rs @@ -139,7 +139,7 @@ pub(crate) struct ListToken { impl Default for ListToken { #[inline] fn default() -> Self { - ListToken { + Self { block: ptr::null(), offset: 0, } diff --git a/crossbeam-channel/src/flavors/list.rs b/crossbeam-channel/src/flavors/list.rs --- a/crossbeam-channel/src/flavors/list.rs +++ b/crossbeam-channel/src/flavors/list.rs @@ -170,7 +170,7 @@ pub(crate) struct Channel<T> { impl<T> Channel<T> { /// Creates a new unbounded channel. pub(crate) fn new() -> Self { - Channel { + Self { head: CachePadded::new(Position { block: AtomicPtr::new(ptr::null_mut()), index: AtomicUsize::new(0), diff --git a/crossbeam-channel/src/flavors/never.rs b/crossbeam-channel/src/flavors/never.rs --- a/crossbeam-channel/src/flavors/never.rs +++ b/crossbeam-channel/src/flavors/never.rs @@ -22,7 +22,7 @@ impl<T> Channel<T> { /// Creates a channel that never delivers messages. #[inline] pub(crate) fn new() -> Self { - Channel { + Self { _marker: PhantomData, } } diff --git a/crossbeam-channel/src/flavors/tick.rs b/crossbeam-channel/src/flavors/tick.rs --- a/crossbeam-channel/src/flavors/tick.rs +++ b/crossbeam-channel/src/flavors/tick.rs @@ -27,7 +27,7 @@ impl Channel { /// Creates a channel that delivers messages periodically. #[inline] pub(crate) fn new(delivery_time: Instant, dur: Duration) -> Self { - Channel { + Self { delivery_time: AtomicCell::new(delivery_time), duration: dur, } diff --git a/crossbeam-channel/src/flavors/zero.rs b/crossbeam-channel/src/flavors/zero.rs --- a/crossbeam-channel/src/flavors/zero.rs +++ b/crossbeam-channel/src/flavors/zero.rs @@ -45,8 +45,8 @@ struct Packet<T> { impl<T> Packet<T> { /// Creates an empty packet on the stack. - fn empty_on_stack() -> Packet<T> { - Packet { + fn empty_on_stack() -> Self { + Self { on_stack: true, ready: AtomicBool::new(false), msg: UnsafeCell::new(None), diff --git a/crossbeam-channel/src/flavors/zero.rs b/crossbeam-channel/src/flavors/zero.rs --- a/crossbeam-channel/src/flavors/zero.rs +++ b/crossbeam-channel/src/flavors/zero.rs @@ -54,8 +54,8 @@ impl<T> Packet<T> { } /// Creates an empty packet on the heap. - fn empty_on_heap() -> Box<Packet<T>> { - Box::new(Packet { + fn empty_on_heap() -> Box<Self> { + Box::new(Self { on_stack: false, ready: AtomicBool::new(false), msg: UnsafeCell::new(None), diff --git a/crossbeam-channel/src/flavors/zero.rs b/crossbeam-channel/src/flavors/zero.rs --- a/crossbeam-channel/src/flavors/zero.rs +++ b/crossbeam-channel/src/flavors/zero.rs @@ -63,8 +63,8 @@ impl<T> Packet<T> { } /// Creates a packet on the stack, containing a message. - fn message_on_stack(msg: T) -> Packet<T> { - Packet { + fn message_on_stack(msg: T) -> Self { + Self { on_stack: true, ready: AtomicBool::new(false), msg: UnsafeCell::new(Some(msg)), diff --git a/crossbeam-channel/src/flavors/zero.rs b/crossbeam-channel/src/flavors/zero.rs --- a/crossbeam-channel/src/flavors/zero.rs +++ b/crossbeam-channel/src/flavors/zero.rs @@ -104,7 +104,7 @@ pub(crate) struct Channel<T> { impl<T> Channel<T> { /// Constructs a new zero-capacity channel. pub(crate) fn new() -> Self { - Channel { + Self { inner: Mutex::new(Inner { senders: Waker::new(), receivers: Waker::new(), diff --git a/crossbeam-channel/src/select.rs b/crossbeam-channel/src/select.rs --- a/crossbeam-channel/src/select.rs +++ b/crossbeam-channel/src/select.rs @@ -42,12 +42,12 @@ impl Operation { /// reference should point to a variable that is specific to the thread and the operation, /// and is alive for the entire duration of select or blocking operation. #[inline] - pub fn hook<T>(r: &mut T) -> Operation { + pub fn hook<T>(r: &mut T) -> Self { let val = r as *mut T as usize; // Make sure that the pointer address doesn't equal the numerical representation of // `Selected::{Waiting, Aborted, Disconnected}`. assert!(val > 2); - Operation(val) + Self(val) } } diff --git a/crossbeam-channel/src/select.rs b/crossbeam-channel/src/select.rs --- a/crossbeam-channel/src/select.rs +++ b/crossbeam-channel/src/select.rs @@ -69,12 +69,12 @@ pub enum Selected { impl From<usize> for Selected { #[inline] - fn from(val: usize) -> Selected { + fn from(val: usize) -> Self { match val { - 0 => Selected::Waiting, - 1 => Selected::Aborted, - 2 => Selected::Disconnected, - oper => Selected::Operation(Operation(oper)), + 0 => Self::Waiting, + 1 => Self::Aborted, + 2 => Self::Disconnected, + oper => Self::Operation(Operation(oper)), } } } diff --git a/crossbeam-channel/src/select.rs b/crossbeam-channel/src/select.rs --- a/crossbeam-channel/src/select.rs +++ b/crossbeam-channel/src/select.rs @@ -618,8 +618,8 @@ impl<'a> Select<'a> { /// // The list of operations is empty, which means no operation can be selected. /// assert!(sel.try_select().is_err()); /// ``` - pub fn new() -> Select<'a> { - Select { + pub fn new() -> Self { + Self { handles: Vec::with_capacity(4), next_index: 0, } diff --git a/crossbeam-channel/src/select.rs b/crossbeam-channel/src/select.rs --- a/crossbeam-channel/src/select.rs +++ b/crossbeam-channel/src/select.rs @@ -1128,18 +1128,18 @@ impl<'a> Select<'a> { } } -impl<'a> Clone for Select<'a> { - fn clone(&self) -> Select<'a> { - Select { +impl Clone for Select<'_> { + fn clone(&self) -> Self { + Self { handles: self.handles.clone(), next_index: self.next_index, } } } -impl<'a> Default for Select<'a> { - fn default() -> Select<'a> { - Select::new() +impl Default for Select<'_> { + fn default() -> Self { + Self::new() } } diff --git a/crossbeam-channel/src/select_macro.rs b/crossbeam-channel/src/select_macro.rs --- a/crossbeam-channel/src/select_macro.rs +++ b/crossbeam-channel/src/select_macro.rs @@ -685,7 +685,7 @@ macro_rules! crossbeam_channel_internal { $default:tt ) => {{ const _LEN: usize = $crate::crossbeam_channel_internal!(@count ($($cases)*)); - let _handle: &$crate::internal::SelectHandle = &$crate::never::<()>(); + let _handle: &dyn $crate::internal::SelectHandle = &$crate::never::<()>(); #[allow(unused_mut)] let mut _sel = [(_handle, 0, ::std::ptr::null()); _LEN]; diff --git a/crossbeam-channel/src/waker.rs b/crossbeam-channel/src/waker.rs --- a/crossbeam-channel/src/waker.rs +++ b/crossbeam-channel/src/waker.rs @@ -36,7 +36,7 @@ impl Waker { /// Creates a new `Waker`. #[inline] pub(crate) fn new() -> Self { - Waker { + Self { selectors: Vec::new(), observers: Vec::new(), } diff --git a/crossbeam-channel/src/waker.rs b/crossbeam-channel/src/waker.rs --- a/crossbeam-channel/src/waker.rs +++ b/crossbeam-channel/src/waker.rs @@ -186,7 +186,7 @@ impl SyncWaker { /// Creates a new `SyncWaker`. #[inline] pub(crate) fn new() -> Self { - SyncWaker { + Self { inner: Mutex::new(Waker::new()), is_empty: AtomicBool::new(true), } diff --git a/crossbeam-deque/Cargo.toml b/crossbeam-deque/Cargo.toml --- a/crossbeam-deque/Cargo.toml +++ b/crossbeam-deque/Cargo.toml @@ -5,7 +5,7 @@ name = "crossbeam-deque" # - Update README.md # - Create "crossbeam-deque-X.Y.Z" git tag version = "0.8.3" -edition = "2018" +edition = "2021" rust-version = "1.61" license = "MIT OR Apache-2.0" repository = "https://github.com/crossbeam-rs/crossbeam" diff --git a/crossbeam-deque/Cargo.toml b/crossbeam-deque/Cargo.toml --- a/crossbeam-deque/Cargo.toml +++ b/crossbeam-deque/Cargo.toml @@ -40,3 +40,6 @@ optional = true [dev-dependencies] rand = "0.8" + +[lints] +workspace = true diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -1,7 +1,6 @@ use std::cell::{Cell, UnsafeCell}; use std::cmp; use std::fmt; -use std::iter::FromIterator; use std::marker::PhantomData; use std::mem::{self, ManuallyDrop, MaybeUninit}; use std::ptr; diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -35,13 +34,13 @@ unsafe impl<T> Send for Buffer<T> {} impl<T> Buffer<T> { /// Allocates a new buffer with the specified capacity. - fn alloc(cap: usize) -> Buffer<T> { + fn alloc(cap: usize) -> Self { debug_assert_eq!(cap, cap.next_power_of_two()); let mut v = ManuallyDrop::new(Vec::with_capacity(cap)); let ptr = v.as_mut_ptr(); - Buffer { ptr, cap } + Self { ptr, cap } } /// Deallocates the buffer. diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -79,7 +78,7 @@ impl<T> Buffer<T> { } impl<T> Clone for Buffer<T> { - fn clone(&self) -> Buffer<T> { + fn clone(&self) -> Self { *self } } diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -210,7 +209,7 @@ impl<T> Worker<T> { /// /// let w = Worker::<i32>::new_fifo(); /// ``` - pub fn new_fifo() -> Worker<T> { + pub fn new_fifo() -> Self { let buffer = Buffer::alloc(MIN_CAP); let inner = Arc::new(CachePadded::new(Inner { diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -219,7 +218,7 @@ impl<T> Worker<T> { buffer: CachePadded::new(Atomic::new(buffer)), })); - Worker { + Self { inner, buffer: Cell::new(buffer), flavor: Flavor::Fifo, diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -238,7 +237,7 @@ impl<T> Worker<T> { /// /// let w = Worker::<i32>::new_lifo(); /// ``` - pub fn new_lifo() -> Worker<T> { + pub fn new_lifo() -> Self { let buffer = Buffer::alloc(MIN_CAP); let inner = Arc::new(CachePadded::new(Inner { diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -247,7 +246,7 @@ impl<T> Worker<T> { buffer: CachePadded::new(Atomic::new(buffer)), })); - Worker { + Self { inner, buffer: Cell::new(buffer), flavor: Flavor::Lifo, diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -1155,8 +1154,8 @@ impl<T> Stealer<T> { } impl<T> Clone for Stealer<T> { - fn clone(&self) -> Stealer<T> { - Stealer { + fn clone(&self) -> Self { + Self { inner: self.inner.clone(), flavor: self.flavor, } diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -1223,7 +1222,7 @@ struct Block<T> { impl<T> Block<T> { /// Creates an empty block that starts at `start_index`. - fn new() -> Block<T> { + fn new() -> Self { Self { next: AtomicPtr::new(ptr::null_mut()), slots: [Slot::UNINIT; BLOCK_CAP], diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -1231,7 +1230,7 @@ impl<T> Block<T> { } /// Waits until the next pointer is set. - fn wait_next(&self) -> *mut Block<T> { + fn wait_next(&self) -> *mut Self { let backoff = Backoff::new(); loop { let next = self.next.load(Ordering::Acquire); diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -1243,7 +1242,7 @@ impl<T> Block<T> { } /// Sets the `DESTROY` bit in slots starting from `start` and destroys the block. - unsafe fn destroy(this: *mut Block<T>, count: usize) { + unsafe fn destroy(this: *mut Self, count: usize) { // It is not necessary to set the `DESTROY` bit in the last slot because that slot has // begun destruction of the block. for i in (0..count).rev() { diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -1331,7 +1330,7 @@ impl<T> Injector<T> { /// /// let q = Injector::<i32>::new(); /// ``` - pub fn new() -> Injector<T> { + pub fn new() -> Self { Self::default() } diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -2056,7 +2055,7 @@ impl<T> Steal<T> { /// assert!(Empty::<i32>.is_empty()); /// ``` pub fn is_empty(&self) -> bool { - matches!(self, Steal::Empty) + matches!(self, Self::Empty) } /// Returns `true` if at least one task was stolen. diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -2072,7 +2071,7 @@ impl<T> Steal<T> { /// assert!(Success(7).is_success()); /// ``` pub fn is_success(&self) -> bool { - matches!(self, Steal::Success(_)) + matches!(self, Self::Success(_)) } /// Returns `true` if the steal operation needs to be retried. diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -2088,7 +2087,7 @@ impl<T> Steal<T> { /// assert!(Retry::<i32>.is_retry()); /// ``` pub fn is_retry(&self) -> bool { - matches!(self, Steal::Retry) + matches!(self, Self::Retry) } /// Returns the result of the operation, if successful. diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -2105,7 +2104,7 @@ impl<T> Steal<T> { /// ``` pub fn success(self) -> Option<T> { match self { - Steal::Success(res) => Some(res), + Self::Success(res) => Some(res), _ => None, } } diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -2131,18 +2130,18 @@ impl<T> Steal<T> { /// /// assert_eq!(Empty.or_else(|| Empty), Empty::<i32>); /// ``` - pub fn or_else<F>(self, f: F) -> Steal<T> + pub fn or_else<F>(self, f: F) -> Self where - F: FnOnce() -> Steal<T>, + F: FnOnce() -> Self, { match self { - Steal::Empty => f(), - Steal::Success(_) => self, - Steal::Retry => { - if let Steal::Success(res) = f() { - Steal::Success(res) + Self::Empty => f(), + Self::Success(_) => self, + Self::Retry => { + if let Self::Success(res) = f() { + Self::Success(res) } else { - Steal::Retry + Self::Retry } } } diff --git a/crossbeam-deque/src/deque.rs b/crossbeam-deque/src/deque.rs --- a/crossbeam-deque/src/deque.rs +++ b/crossbeam-deque/src/deque.rs @@ -2152,35 +2151,35 @@ impl<T> Steal<T> { impl<T> fmt::Debug for Steal<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - Steal::Empty => f.pad("Empty"), - Steal::Success(_) => f.pad("Success(..)"), - Steal::Retry => f.pad("Retry"), + Self::Empty => f.pad("Empty"), + Self::Success(_) => f.pad("Success(..)"), + Self::Retry => f.pad("Retry"), } } } -impl<T> FromIterator<Steal<T>> for Steal<T> { +impl<T> FromIterator<Self> for Steal<T> { /// Consumes items until a `Success` is found and returns it. /// /// If no `Success` was found, but there was at least one `Retry`, then returns `Retry`. /// Otherwise, `Empty` is returned. - fn from_iter<I>(iter: I) -> Steal<T> + fn from_iter<I>(iter: I) -> Self where - I: IntoIterator<Item = Steal<T>>, + I: IntoIterator<Item = Self>, { let mut retry = false; for s in iter { match &s { - Steal::Empty => {} - Steal::Success(_) => return s, - Steal::Retry => retry = true, + Self::Empty => {} + Self::Success(_) => return s, + Self::Retry => retry = true, } } if retry { - Steal::Retry + Self::Retry } else { - Steal::Empty + Self::Empty } } } diff --git a/crossbeam-epoch/Cargo.toml b/crossbeam-epoch/Cargo.toml --- a/crossbeam-epoch/Cargo.toml +++ b/crossbeam-epoch/Cargo.toml @@ -5,7 +5,7 @@ name = "crossbeam-epoch" # - Update README.md # - Create "crossbeam-epoch-X.Y.Z" git tag version = "0.9.15" -edition = "2018" +edition = "2021" rust-version = "1.61" license = "MIT OR Apache-2.0" repository = "https://github.com/crossbeam-rs/crossbeam" diff --git a/crossbeam-epoch/Cargo.toml b/crossbeam-epoch/Cargo.toml --- a/crossbeam-epoch/Cargo.toml +++ b/crossbeam-epoch/Cargo.toml @@ -55,3 +54,6 @@ default-features = false [dev-dependencies] rand = "0.8" + +[lints] +workspace = true diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -265,7 +265,7 @@ impl<T> Atomic<T> { /// let a = Atomic::new(1234); /// # unsafe { drop(a.into_owned()); } // avoid leak /// ``` - pub fn new(init: T) -> Atomic<T> { + pub fn new(init: T) -> Self { Self::init(init) } } diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -281,7 +281,7 @@ impl<T: ?Sized + Pointable> Atomic<T> { /// let a = Atomic::<i32>::init(1234); /// # unsafe { drop(a.into_owned()); } // avoid leak /// ``` - pub fn init(init: T::Init) -> Atomic<T> { + pub fn init(init: T::Init) -> Self { Self::from(Owned::init(init)) } diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -303,7 +303,7 @@ impl<T: ?Sized + Pointable> Atomic<T> { /// let a = Atomic::<i32>::null(); /// ``` #[cfg(not(crossbeam_loom))] - pub const fn null() -> Atomic<T> { + pub const fn null() -> Self { Self { data: AtomicPtr::new(ptr::null_mut()), _marker: PhantomData, diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -311,7 +311,7 @@ impl<T: ?Sized + Pointable> Atomic<T> { } /// Returns a new null atomic pointer. #[cfg(crossbeam_loom)] - pub fn null() -> Atomic<T> { + pub fn null() -> Self { Self { data: AtomicPtr::new(ptr::null_mut()), _marker: PhantomData, diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -846,13 +846,13 @@ impl<T: ?Sized + Pointable> Clone for Atomic<T> { /// atomics or fences. fn clone(&self) -> Self { let data = self.data.load(Ordering::Relaxed); - Atomic::from_ptr(data) + Self::from_ptr(data) } } impl<T: ?Sized + Pointable> Default for Atomic<T> { fn default() -> Self { - Atomic::null() + Self::null() } } diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -991,7 +991,7 @@ impl<T> Owned<T> { /// /// let o = unsafe { Owned::from_raw(Box::into_raw(Box::new(1234))) }; /// ``` - pub unsafe fn from_raw(raw: *mut T) -> Owned<T> { + pub unsafe fn from_raw(raw: *mut T) -> Self { let raw = raw.cast::<()>(); ensure_aligned::<T>(raw); Self::from_ptr(raw) diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -1023,7 +1023,7 @@ impl<T> Owned<T> { /// /// let o = Owned::new(1234); /// ``` - pub fn new(init: T) -> Owned<T> { + pub fn new(init: T) -> Self { Self::init(init) } } diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -1038,7 +1038,7 @@ impl<T: ?Sized + Pointable> Owned<T> { /// /// let o = Owned::<i32>::init(1234); /// ``` - pub fn init(init: T::Init) -> Owned<T> { + pub fn init(init: T::Init) -> Self { unsafe { Self::from_ptr(T::init(init)) } } diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -1086,7 +1086,7 @@ impl<T: ?Sized + Pointable> Owned<T> { /// let o = o.with_tag(2); /// assert_eq!(o.tag(), 2); /// ``` - pub fn with_tag(self, tag: usize) -> Owned<T> { + pub fn with_tag(self, tag: usize) -> Self { let data = self.into_ptr(); unsafe { Self::from_ptr(compose_tag::<T>(data, tag)) } } diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -1114,7 +1114,7 @@ impl<T: ?Sized + Pointable> fmt::Debug for Owned<T> { impl<T: Clone> Clone for Owned<T> { fn clone(&self) -> Self { - Owned::new((**self).clone()).with_tag(self.tag()) + Self::new((**self).clone()).with_tag(self.tag()) } } diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -1136,7 +1136,7 @@ impl<T: ?Sized + Pointable> DerefMut for Owned<T> { impl<T> From<T> for Owned<T> { fn from(t: T) -> Self { - Owned::new(t) + Self::new(t) } } diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -1218,7 +1218,7 @@ impl<T: ?Sized + Pointable> Pointer<T> for Shared<'_, T> { } } -impl<'g, T> Shared<'g, T> { +impl<T> Shared<'_, T> { /// Converts the pointer to a raw pointer (without the tag). /// /// # Examples diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -1253,8 +1253,8 @@ impl<'g, T: ?Sized + Pointable> Shared<'g, T> { /// let p = Shared::<i32>::null(); /// assert!(p.is_null()); /// ``` - pub fn null() -> Shared<'g, T> { - Shared { + pub fn null() -> Self { + Self { data: ptr::null_mut(), _marker: PhantomData, } diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -1564,7 +1564,7 @@ impl<T: ?Sized + Pointable> fmt::Pointer for Shared<'_, T> { impl<T: ?Sized + Pointable> Default for Shared<'_, T> { fn default() -> Self { - Shared::null() + Self::null() } } diff --git a/crossbeam-epoch/src/collector.rs b/crossbeam-epoch/src/collector.rs --- a/crossbeam-epoch/src/collector.rs +++ b/crossbeam-epoch/src/collector.rs @@ -50,7 +50,7 @@ impl Collector { impl Clone for Collector { /// Creates another reference to the same garbage collector. fn clone(&self) -> Self { - Collector { + Self { global: self.global.clone(), } } diff --git a/crossbeam-epoch/src/collector.rs b/crossbeam-epoch/src/collector.rs --- a/crossbeam-epoch/src/collector.rs +++ b/crossbeam-epoch/src/collector.rs @@ -64,7 +64,7 @@ impl fmt::Debug for Collector { impl PartialEq for Collector { /// Checks if both handles point to the same collector. - fn eq(&self, rhs: &Collector) -> bool { + fn eq(&self, rhs: &Self) -> bool { Arc::ptr_eq(&self.global, &rhs.global) } } diff --git a/crossbeam-epoch/src/deferred.rs b/crossbeam-epoch/src/deferred.rs --- a/crossbeam-epoch/src/deferred.rs +++ b/crossbeam-epoch/src/deferred.rs @@ -53,7 +53,7 @@ impl Deferred { f(); } - Deferred { + Self { call: call::<F>, data, _marker: PhantomData, diff --git a/crossbeam-epoch/src/deferred.rs b/crossbeam-epoch/src/deferred.rs --- a/crossbeam-epoch/src/deferred.rs +++ b/crossbeam-epoch/src/deferred.rs @@ -70,7 +70,7 @@ impl Deferred { (*b)(); } - Deferred { + Self { call: call::<F>, data, _marker: PhantomData, diff --git a/crossbeam-epoch/src/epoch.rs b/crossbeam-epoch/src/epoch.rs --- a/crossbeam-epoch/src/epoch.rs +++ b/crossbeam-epoch/src/epoch.rs @@ -45,16 +45,16 @@ impl Epoch { /// Returns the same epoch, but marked as pinned. #[inline] - pub(crate) fn pinned(self) -> Epoch { - Epoch { + pub(crate) fn pinned(self) -> Self { + Self { data: self.data | 1, } } /// Returns the same epoch, but marked as unpinned. #[inline] - pub(crate) fn unpinned(self) -> Epoch { - Epoch { + pub(crate) fn unpinned(self) -> Self { + Self { data: self.data & !1, } } diff --git a/crossbeam-epoch/src/epoch.rs b/crossbeam-epoch/src/epoch.rs --- a/crossbeam-epoch/src/epoch.rs +++ b/crossbeam-epoch/src/epoch.rs @@ -63,8 +63,8 @@ impl Epoch { /// /// The returned epoch will be marked as pinned only if the previous one was as well. #[inline] - pub(crate) fn successor(self) -> Epoch { - Epoch { + pub(crate) fn successor(self) -> Self { + Self { data: self.data.wrapping_add(2), } } diff --git a/crossbeam-epoch/src/epoch.rs b/crossbeam-epoch/src/epoch.rs --- a/crossbeam-epoch/src/epoch.rs +++ b/crossbeam-epoch/src/epoch.rs @@ -83,7 +83,7 @@ impl AtomicEpoch { #[inline] pub(crate) fn new(epoch: Epoch) -> Self { let data = AtomicUsize::new(epoch.data); - AtomicEpoch { data } + Self { data } } /// Loads a value from the atomic epoch. diff --git a/crossbeam-epoch/src/guard.rs b/crossbeam-epoch/src/guard.rs --- a/crossbeam-epoch/src/guard.rs +++ b/crossbeam-epoch/src/guard.rs @@ -1,8 +1,6 @@ use core::fmt; use core::mem; -use scopeguard::defer; - use crate::atomic::Shared; use crate::collector::Collector; use crate::deferred::Deferred; diff --git a/crossbeam-epoch/src/guard.rs b/crossbeam-epoch/src/guard.rs --- a/crossbeam-epoch/src/guard.rs +++ b/crossbeam-epoch/src/guard.rs @@ -366,6 +364,17 @@ impl Guard { where F: FnOnce() -> R, { + // Ensure the Guard is re-pinned even if the function panics + struct ScopeGuard(*const Local); + impl Drop for ScopeGuard { + fn drop(&mut self) { + if let Some(local) = unsafe { self.0.as_ref() } { + mem::forget(local.pin()); + local.release_handle(); + } + } + } + if let Some(local) = unsafe { self.local.as_ref() } { // We need to acquire a handle here to ensure the Local doesn't // disappear from under us. diff --git a/crossbeam-epoch/src/guard.rs b/crossbeam-epoch/src/guard.rs --- a/crossbeam-epoch/src/guard.rs +++ b/crossbeam-epoch/src/guard.rs @@ -373,13 +382,7 @@ impl Guard { local.unpin(); } - // Ensure the Guard is re-pinned even if the function panics - defer! { - if let Some(local) = unsafe { self.local.as_ref() } { - mem::forget(local.pin()); - local.release_handle(); - } - } + let _guard = ScopeGuard(self.local); f() } diff --git a/crossbeam-epoch/src/internal.rs b/crossbeam-epoch/src/internal.rs --- a/crossbeam-epoch/src/internal.rs +++ b/crossbeam-epoch/src/internal.rs @@ -107,7 +107,7 @@ impl Bag { impl Default for Bag { fn default() -> Self { - Bag { + Self { len: 0, deferreds: [Deferred::NO_OP; MAX_OBJECTS], } diff --git a/crossbeam-epoch/src/internal.rs b/crossbeam-epoch/src/internal.rs --- a/crossbeam-epoch/src/internal.rs +++ b/crossbeam-epoch/src/internal.rs @@ -317,7 +317,7 @@ impl Local { unsafe { // Since we dereference no pointers in this block, it is safe to use `unprotected`. - let local = Owned::new(Local { + let local = Owned::new(Self { entry: Entry::default(), collector: UnsafeCell::new(ManuallyDrop::new(collector.clone())), bag: UnsafeCell::new(Bag::new()), diff --git a/crossbeam-epoch/src/internal.rs b/crossbeam-epoch/src/internal.rs --- a/crossbeam-epoch/src/internal.rs +++ b/crossbeam-epoch/src/internal.rs @@ -534,20 +534,20 @@ impl Local { } } -impl IsElement<Local> for Local { - fn entry_of(local: &Local) -> &Entry { +impl IsElement<Self> for Local { + fn entry_of(local: &Self) -> &Entry { unsafe { - let entry_ptr = (local as *const Local as *const u8) + let entry_ptr = (local as *const Self as *const u8) .add(offset_of!(Local, entry)) .cast::<Entry>(); &*entry_ptr } } - unsafe fn element_of(entry: &Entry) -> &Local { + unsafe fn element_of(entry: &Entry) -> &Self { let local_ptr = (entry as *const Entry as *const u8) .sub(offset_of!(Local, entry)) - .cast::<Local>(); + .cast::<Self>(); &*local_ptr } diff --git a/crossbeam-epoch/src/lib.rs b/crossbeam-epoch/src/lib.rs --- a/crossbeam-epoch/src/lib.rs +++ b/crossbeam-epoch/src/lib.rs @@ -105,8 +100,8 @@ mod primitive { // https://github.com/tokio-rs/loom#handling-loom-api-differences impl<T> UnsafeCell<T> { #[inline] - pub(crate) const fn new(data: T) -> UnsafeCell<T> { - UnsafeCell(::core::cell::UnsafeCell::new(data)) + pub(crate) const fn new(data: T) -> Self { + Self(::core::cell::UnsafeCell::new(data)) } #[inline] diff --git a/crossbeam-epoch/src/sync/queue.rs b/crossbeam-epoch/src/sync/queue.rs --- a/crossbeam-epoch/src/sync/queue.rs +++ b/crossbeam-epoch/src/sync/queue.rs @@ -42,8 +42,8 @@ unsafe impl<T: Send> Send for Queue<T> {} impl<T> Queue<T> { /// Create a new, empty queue. - pub(crate) fn new() -> Queue<T> { - let q = Queue { + pub(crate) fn new() -> Self { + let q = Self { head: CachePadded::new(Atomic::null()), tail: CachePadded::new(Atomic::null()), }; diff --git a/crossbeam-queue/Cargo.toml b/crossbeam-queue/Cargo.toml --- a/crossbeam-queue/Cargo.toml +++ b/crossbeam-queue/Cargo.toml @@ -5,7 +5,7 @@ name = "crossbeam-queue" # - Update README.md # - Create "crossbeam-queue-X.Y.Z" git tag version = "0.3.8" -edition = "2018" +edition = "2021" rust-version = "1.61" license = "MIT OR Apache-2.0" repository = "https://github.com/crossbeam-rs/crossbeam" diff --git a/crossbeam-queue/Cargo.toml b/crossbeam-queue/Cargo.toml --- a/crossbeam-queue/Cargo.toml +++ b/crossbeam-queue/Cargo.toml @@ -37,3 +37,6 @@ default-features = false [dev-dependencies] rand = "0.8" + +[lints] +workspace = true diff --git a/crossbeam-queue/src/array_queue.rs b/crossbeam-queue/src/array_queue.rs --- a/crossbeam-queue/src/array_queue.rs +++ b/crossbeam-queue/src/array_queue.rs @@ -90,7 +90,7 @@ impl<T> ArrayQueue<T> { /// /// let q = ArrayQueue::<i32>::new(100); /// ``` - pub fn new(cap: usize) -> ArrayQueue<T> { + pub fn new(cap: usize) -> Self { assert!(cap > 0, "capacity must be non-zero"); // Head is initialized to `{ lap: 0, index: 0 }`. diff --git a/crossbeam-queue/src/array_queue.rs b/crossbeam-queue/src/array_queue.rs --- a/crossbeam-queue/src/array_queue.rs +++ b/crossbeam-queue/src/array_queue.rs @@ -113,7 +113,7 @@ impl<T> ArrayQueue<T> { // One lap is the smallest power of two greater than `cap`. let one_lap = (cap + 1).next_power_of_two(); - ArrayQueue { + Self { buffer, cap, one_lap, diff --git a/crossbeam-queue/src/seg_queue.rs b/crossbeam-queue/src/seg_queue.rs --- a/crossbeam-queue/src/seg_queue.rs +++ b/crossbeam-queue/src/seg_queue.rs @@ -62,7 +62,7 @@ struct Block<T> { impl<T> Block<T> { /// Creates an empty block that starts at `start_index`. - fn new() -> Block<T> { + fn new() -> Self { Self { next: AtomicPtr::new(ptr::null_mut()), slots: [Slot::UNINIT; BLOCK_CAP], diff --git a/crossbeam-queue/src/seg_queue.rs b/crossbeam-queue/src/seg_queue.rs --- a/crossbeam-queue/src/seg_queue.rs +++ b/crossbeam-queue/src/seg_queue.rs @@ -70,7 +70,7 @@ impl<T> Block<T> { } /// Waits until the next pointer is set. - fn wait_next(&self) -> *mut Block<T> { + fn wait_next(&self) -> *mut Self { let backoff = Backoff::new(); loop { let next = self.next.load(Ordering::Acquire); diff --git a/crossbeam-queue/src/seg_queue.rs b/crossbeam-queue/src/seg_queue.rs --- a/crossbeam-queue/src/seg_queue.rs +++ b/crossbeam-queue/src/seg_queue.rs @@ -82,7 +82,7 @@ impl<T> Block<T> { } /// Sets the `DESTROY` bit in slots starting from `start` and destroys the block. - unsafe fn destroy(this: *mut Block<T>, start: usize) { + unsafe fn destroy(this: *mut Self, start: usize) { // It is not necessary to set the `DESTROY` bit in the last slot because that slot has // begun destruction of the block. for i in start..BLOCK_CAP - 1 { diff --git a/crossbeam-queue/src/seg_queue.rs b/crossbeam-queue/src/seg_queue.rs --- a/crossbeam-queue/src/seg_queue.rs +++ b/crossbeam-queue/src/seg_queue.rs @@ -158,8 +158,8 @@ impl<T> SegQueue<T> { /// /// let q = SegQueue::<i32>::new(); /// ``` - pub const fn new() -> SegQueue<T> { - SegQueue { + pub const fn new() -> Self { + Self { head: CachePadded::new(Position { block: AtomicPtr::new(ptr::null_mut()), index: AtomicUsize::new(0), diff --git a/crossbeam-queue/src/seg_queue.rs b/crossbeam-queue/src/seg_queue.rs --- a/crossbeam-queue/src/seg_queue.rs +++ b/crossbeam-queue/src/seg_queue.rs @@ -482,8 +482,8 @@ impl<T> fmt::Debug for SegQueue<T> { } impl<T> Default for SegQueue<T> { - fn default() -> SegQueue<T> { - SegQueue::new() + fn default() -> Self { + Self::new() } } diff --git a/crossbeam-skiplist/Cargo.toml b/crossbeam-skiplist/Cargo.toml --- a/crossbeam-skiplist/Cargo.toml +++ b/crossbeam-skiplist/Cargo.toml @@ -5,7 +5,7 @@ name = "crossbeam-skiplist" # - Update README.md # - Create "crossbeam-skiplist-X.Y.Z" git tag version = "0.1.1" -edition = "2018" +edition = "2021" rust-version = "1.61" license = "MIT OR Apache-2.0" repository = "https://github.com/crossbeam-rs/crossbeam" diff --git a/crossbeam-skiplist/Cargo.toml b/crossbeam-skiplist/Cargo.toml --- a/crossbeam-skiplist/Cargo.toml +++ b/crossbeam-skiplist/Cargo.toml @@ -41,9 +41,8 @@ version = "0.8.5" path = "../crossbeam-utils" default-features = false -[dependencies.scopeguard] -version = "1.1.0" -default-features = false - [dev-dependencies] rand = "0.8" + +[lints] +workspace = true diff --git a/crossbeam-skiplist/src/base.rs b/crossbeam-skiplist/src/base.rs --- a/crossbeam-skiplist/src/base.rs +++ b/crossbeam-skiplist/src/base.rs @@ -52,9 +52,9 @@ struct Head<K, V> { impl<K, V> Head<K, V> { /// Initializes a `Head`. #[inline] - fn new() -> Head<K, V> { + fn new() -> Self { // Initializing arrays in rust is a pain... - Head { + Self { pointers: Default::default(), } } diff --git a/crossbeam-skiplist/src/base.rs b/crossbeam-skiplist/src/base.rs --- a/crossbeam-skiplist/src/base.rs +++ b/crossbeam-skiplist/src/base.rs @@ -256,7 +256,7 @@ impl<K, V> Node<K, V> { ptr::drop_in_place(&mut (*ptr).value); // Finally, deallocate the memory occupied by the node. - Node::dealloc(ptr); + Self::dealloc(ptr); } } diff --git a/crossbeam-skiplist/src/base.rs b/crossbeam-skiplist/src/base.rs --- a/crossbeam-skiplist/src/base.rs +++ b/crossbeam-skiplist/src/base.rs @@ -332,8 +332,8 @@ unsafe impl<K: Send + Sync, V: Send + Sync> Sync for SkipList<K, V> {} impl<K, V> SkipList<K, V> { /// Returns a new, empty skip list. - pub fn new(collector: Collector) -> SkipList<K, V> { - SkipList { + pub fn new(collector: Collector) -> Self { + Self { head: Head::new(), collector, hot_data: CachePadded::new(HotData { diff --git a/crossbeam-skiplist/src/base.rs b/crossbeam-skiplist/src/base.rs --- a/crossbeam-skiplist/src/base.rs +++ b/crossbeam-skiplist/src/base.rs @@ -937,9 +937,13 @@ where // We failed. Let's search for the key and try again. { // Create a guard that destroys the new node in case search panics. - let sg = scopeguard::guard((), |_| { - Node::finalize(node.as_raw()); - }); + struct ScopeGuard<K, V>(*const Node<K, V>); + impl<K, V> Drop for ScopeGuard<K, V> { + fn drop(&mut self) { + unsafe { Node::finalize(self.0) } + } + } + let sg = ScopeGuard(node.as_raw()); search = self.search_position(&n.key, guard); mem::forget(sg); } diff --git a/crossbeam-skiplist/src/base.rs b/crossbeam-skiplist/src/base.rs --- a/crossbeam-skiplist/src/base.rs +++ b/crossbeam-skiplist/src/base.rs @@ -1345,7 +1349,7 @@ impl<'a: 'g, 'g, K: 'a, V: 'a> Entry<'a, 'g, K, V> { } } -impl<'a: 'g, 'g, K, V> Entry<'a, 'g, K, V> +impl<K, V> Entry<'_, '_, K, V> where K: Ord + Send + 'static, V: Send + 'static, diff --git a/crossbeam-skiplist/src/base.rs b/crossbeam-skiplist/src/base.rs --- a/crossbeam-skiplist/src/base.rs +++ b/crossbeam-skiplist/src/base.rs @@ -1370,9 +1374,9 @@ where } } -impl<'a: 'g, 'g, K, V> Clone for Entry<'a, 'g, K, V> { - fn clone(&self) -> Entry<'a, 'g, K, V> { - Entry { +impl<K, V> Clone for Entry<'_, '_, K, V> { + fn clone(&self) -> Self { + Self { parent: self.parent, node: self.node, guard: self.guard, diff --git a/crossbeam-skiplist/src/base.rs b/crossbeam-skiplist/src/base.rs --- a/crossbeam-skiplist/src/base.rs +++ b/crossbeam-skiplist/src/base.rs @@ -1538,13 +1542,13 @@ where } } -impl<'a, K, V> Clone for RefEntry<'a, K, V> { - fn clone(&self) -> RefEntry<'a, K, V> { +impl<K, V> Clone for RefEntry<'_, K, V> { + fn clone(&self) -> Self { unsafe { // Incrementing will always succeed since we're already holding a reference to the node. Node::try_increment(self.node); } - RefEntry { + Self { parent: self.parent, node: self.node, } diff --git a/crossbeam-skiplist/src/map.rs b/crossbeam-skiplist/src/map.rs --- a/crossbeam-skiplist/src/map.rs +++ b/crossbeam-skiplist/src/map.rs @@ -2,7 +2,6 @@ use std::borrow::Borrow; use std::fmt; -use std::iter::FromIterator; use std::mem::ManuallyDrop; use std::ops::{Bound, RangeBounds}; use std::ptr; diff --git a/crossbeam-skiplist/src/map.rs b/crossbeam-skiplist/src/map.rs --- a/crossbeam-skiplist/src/map.rs +++ b/crossbeam-skiplist/src/map.rs @@ -30,8 +29,8 @@ impl<K, V> SkipMap<K, V> { /// /// let map: SkipMap<i32, &str> = SkipMap::new(); /// ``` - pub fn new() -> SkipMap<K, V> { - SkipMap { + pub fn new() -> Self { + Self { inner: base::SkipList::new(epoch::default_collector().clone()), } } diff --git a/crossbeam-skiplist/src/map.rs b/crossbeam-skiplist/src/map.rs --- a/crossbeam-skiplist/src/map.rs +++ b/crossbeam-skiplist/src/map.rs @@ -506,8 +505,8 @@ where } impl<K, V> Default for SkipMap<K, V> { - fn default() -> SkipMap<K, V> { - SkipMap::new() + fn default() -> Self { + Self::new() } } diff --git a/crossbeam-skiplist/src/map.rs b/crossbeam-skiplist/src/map.rs --- a/crossbeam-skiplist/src/map.rs +++ b/crossbeam-skiplist/src/map.rs @@ -548,11 +547,11 @@ impl<K, V> FromIterator<(K, V)> for SkipMap<K, V> where K: Ord, { - fn from_iter<I>(iter: I) -> SkipMap<K, V> + fn from_iter<I>(iter: I) -> Self where I: IntoIterator<Item = (K, V)>, { - let s = SkipMap::new(); + let s = Self::new(); for (k, v) in iter { s.get_or_insert(k, v); } diff --git a/crossbeam-skiplist/src/map.rs b/crossbeam-skiplist/src/map.rs --- a/crossbeam-skiplist/src/map.rs +++ b/crossbeam-skiplist/src/map.rs @@ -566,8 +565,8 @@ pub struct Entry<'a, K, V> { } impl<'a, K, V> Entry<'a, K, V> { - fn new(inner: base::RefEntry<'a, K, V>) -> Entry<'a, K, V> { - Entry { + fn new(inner: base::RefEntry<'a, K, V>) -> Self { + Self { inner: ManuallyDrop::new(inner), } } diff --git a/crossbeam-skiplist/src/map.rs b/crossbeam-skiplist/src/map.rs --- a/crossbeam-skiplist/src/map.rs +++ b/crossbeam-skiplist/src/map.rs @@ -639,9 +638,9 @@ where } } -impl<'a, K, V> Clone for Entry<'a, K, V> { - fn clone(&self) -> Entry<'a, K, V> { - Entry { +impl<K, V> Clone for Entry<'_, K, V> { + fn clone(&self) -> Self { + Self { inner: self.inner.clone(), } } diff --git a/crossbeam-skiplist/src/map.rs b/crossbeam-skiplist/src/map.rs --- a/crossbeam-skiplist/src/map.rs +++ b/crossbeam-skiplist/src/map.rs @@ -712,7 +711,7 @@ impl<K, V> fmt::Debug for Iter<'_, K, V> { } } -impl<'a, K, V> Drop for Iter<'a, K, V> { +impl<K, V> Drop for Iter<'_, K, V> { fn drop(&mut self) { let guard = &epoch::pin(); self.inner.drop_impl(guard); diff --git a/crossbeam-skiplist/src/set.rs b/crossbeam-skiplist/src/set.rs --- a/crossbeam-skiplist/src/set.rs +++ b/crossbeam-skiplist/src/set.rs @@ -2,7 +2,6 @@ use std::borrow::Borrow; use std::fmt; -use std::iter::FromIterator; use std::ops::Deref; use std::ops::{Bound, RangeBounds}; diff --git a/crossbeam-skiplist/src/set.rs b/crossbeam-skiplist/src/set.rs --- a/crossbeam-skiplist/src/set.rs +++ b/crossbeam-skiplist/src/set.rs @@ -28,8 +27,8 @@ impl<T> SkipSet<T> { /// /// let set: SkipSet<i32> = SkipSet::new(); /// ``` - pub fn new() -> SkipSet<T> { - SkipSet { + pub fn new() -> Self { + Self { inner: map::SkipMap::new(), } } diff --git a/crossbeam-skiplist/src/set.rs b/crossbeam-skiplist/src/set.rs --- a/crossbeam-skiplist/src/set.rs +++ b/crossbeam-skiplist/src/set.rs @@ -392,8 +391,8 @@ where } impl<T> Default for SkipSet<T> { - fn default() -> SkipSet<T> { - SkipSet::new() + fn default() -> Self { + Self::new() } } diff --git a/crossbeam-skiplist/src/set.rs b/crossbeam-skiplist/src/set.rs --- a/crossbeam-skiplist/src/set.rs +++ b/crossbeam-skiplist/src/set.rs @@ -433,11 +432,11 @@ impl<T> FromIterator<T> for SkipSet<T> where T: Ord, { - fn from_iter<I>(iter: I) -> SkipSet<T> + fn from_iter<I>(iter: I) -> Self where I: IntoIterator<Item = T>, { - let s = SkipSet::new(); + let s = Self::new(); for t in iter { s.get_or_insert(t); } diff --git a/crossbeam-skiplist/src/set.rs b/crossbeam-skiplist/src/set.rs --- a/crossbeam-skiplist/src/set.rs +++ b/crossbeam-skiplist/src/set.rs @@ -451,8 +450,8 @@ pub struct Entry<'a, T> { } impl<'a, T> Entry<'a, T> { - fn new(inner: map::Entry<'a, T, ()>) -> Entry<'a, T> { - Entry { inner } + fn new(inner: map::Entry<'a, T, ()>) -> Self { + Self { inner } } /// Returns a reference to the value. diff --git a/crossbeam-skiplist/src/set.rs b/crossbeam-skiplist/src/set.rs --- a/crossbeam-skiplist/src/set.rs +++ b/crossbeam-skiplist/src/set.rs @@ -503,9 +502,9 @@ where } } -impl<'a, T> Clone for Entry<'a, T> { - fn clone(&self) -> Entry<'a, T> { - Entry { +impl<T> Clone for Entry<'_, T> { + fn clone(&self) -> Self { + Self { inner: self.inner.clone(), } } diff --git a/crossbeam-utils/Cargo.toml b/crossbeam-utils/Cargo.toml --- a/crossbeam-utils/Cargo.toml +++ b/crossbeam-utils/Cargo.toml @@ -5,7 +5,7 @@ name = "crossbeam-utils" # - Update README.md # - Create "crossbeam-utils-X.Y.Z" git tag version = "0.8.16" -edition = "2018" +edition = "2021" rust-version = "1.61" license = "MIT OR Apache-2.0" repository = "https://github.com/crossbeam-rs/crossbeam" diff --git a/crossbeam-utils/Cargo.toml b/crossbeam-utils/Cargo.toml --- a/crossbeam-utils/Cargo.toml +++ b/crossbeam-utils/Cargo.toml @@ -33,3 +33,6 @@ loom = { version = "0.7.1", optional = true } [dev-dependencies] rand = "0.8" + +[lints] +workspace = true diff --git a/crossbeam-utils/build.rs b/crossbeam-utils/build.rs --- a/crossbeam-utils/build.rs +++ b/crossbeam-utils/build.rs @@ -10,8 +10,6 @@ // With the exceptions mentioned above, the rustc-cfg emitted by the build // script are *not* public API. -#![warn(rust_2018_idioms)] - use std::env; include!("no_atomic.rs"); diff --git a/crossbeam-utils/src/atomic/atomic_cell.rs b/crossbeam-utils/src/atomic/atomic_cell.rs --- a/crossbeam-utils/src/atomic/atomic_cell.rs +++ b/crossbeam-utils/src/atomic/atomic_cell.rs @@ -6,12 +6,9 @@ use core::cell::UnsafeCell; use core::cmp; use core::fmt; use core::mem::{self, ManuallyDrop, MaybeUninit}; - +use core::panic::{RefUnwindSafe, UnwindSafe}; use core::ptr; -#[cfg(feature = "std")] -use std::panic::{RefUnwindSafe, UnwindSafe}; - use super::seq_lock::SeqLock; /// A thread-safe mutable memory location. diff --git a/crossbeam-utils/src/atomic/atomic_cell.rs b/crossbeam-utils/src/atomic/atomic_cell.rs --- a/crossbeam-utils/src/atomic/atomic_cell.rs +++ b/crossbeam-utils/src/atomic/atomic_cell.rs @@ -48,9 +45,7 @@ pub struct AtomicCell<T> { unsafe impl<T: Send> Send for AtomicCell<T> {} unsafe impl<T: Send> Sync for AtomicCell<T> {} -#[cfg(feature = "std")] impl<T> UnwindSafe for AtomicCell<T> {} -#[cfg(feature = "std")] impl<T> RefUnwindSafe for AtomicCell<T> {} impl<T> AtomicCell<T> { diff --git a/crossbeam-utils/src/atomic/atomic_cell.rs b/crossbeam-utils/src/atomic/atomic_cell.rs --- a/crossbeam-utils/src/atomic/atomic_cell.rs +++ b/crossbeam-utils/src/atomic/atomic_cell.rs @@ -63,8 +58,8 @@ impl<T> AtomicCell<T> { /// /// let a = AtomicCell::new(7); /// ``` - pub const fn new(val: T) -> AtomicCell<T> { - AtomicCell { + pub const fn new(val: T) -> Self { + Self { value: UnsafeCell::new(MaybeUninit::new(val)), } } diff --git a/crossbeam-utils/src/atomic/atomic_cell.rs b/crossbeam-utils/src/atomic/atomic_cell.rs --- a/crossbeam-utils/src/atomic/atomic_cell.rs +++ b/crossbeam-utils/src/atomic/atomic_cell.rs @@ -916,15 +911,15 @@ impl AtomicCell<bool> { } impl<T: Default> Default for AtomicCell<T> { - fn default() -> AtomicCell<T> { - AtomicCell::new(T::default()) + fn default() -> Self { + Self::new(T::default()) } } impl<T> From<T> for AtomicCell<T> { #[inline] - fn from(val: T) -> AtomicCell<T> { - AtomicCell::new(val) + fn from(val: T) -> Self { + Self::new(val) } } diff --git a/crossbeam-utils/src/backoff.rs b/crossbeam-utils/src/backoff.rs --- a/crossbeam-utils/src/backoff.rs +++ b/crossbeam-utils/src/backoff.rs @@ -93,7 +93,7 @@ impl Backoff { /// ``` #[inline] pub fn new() -> Self { - Backoff { step: Cell::new(0) } + Self { step: Cell::new(0) } } /// Resets the `Backoff`. diff --git a/crossbeam-utils/src/backoff.rs b/crossbeam-utils/src/backoff.rs --- a/crossbeam-utils/src/backoff.rs +++ b/crossbeam-utils/src/backoff.rs @@ -283,7 +283,7 @@ impl fmt::Debug for Backoff { } impl Default for Backoff { - fn default() -> Backoff { - Backoff::new() + fn default() -> Self { + Self::new() } } diff --git a/crossbeam-utils/src/cache_padded.rs b/crossbeam-utils/src/cache_padded.rs --- a/crossbeam-utils/src/cache_padded.rs +++ b/crossbeam-utils/src/cache_padded.rs @@ -160,8 +160,8 @@ impl<T> CachePadded<T> { /// /// let padded_value = CachePadded::new(1); /// ``` - pub const fn new(t: T) -> CachePadded<T> { - CachePadded::<T> { value: t } + pub const fn new(t: T) -> Self { + Self { value: t } } /// Returns the inner value. diff --git a/crossbeam-utils/src/cache_padded.rs b/crossbeam-utils/src/cache_padded.rs --- a/crossbeam-utils/src/cache_padded.rs +++ b/crossbeam-utils/src/cache_padded.rs @@ -204,6 +204,6 @@ impl<T: fmt::Debug> fmt::Debug for CachePadded<T> { impl<T> From<T> for CachePadded<T> { fn from(t: T) -> Self { - CachePadded::new(t) + Self::new(t) } } diff --git a/crossbeam-utils/src/sync/parker.rs b/crossbeam-utils/src/sync/parker.rs --- a/crossbeam-utils/src/sync/parker.rs +++ b/crossbeam-utils/src/sync/parker.rs @@ -84,7 +84,7 @@ impl Parker { /// let p = Parker::new(); /// ``` /// - pub fn new() -> Parker { + pub fn new() -> Self { Self::default() } diff --git a/crossbeam-utils/src/sync/parker.rs b/crossbeam-utils/src/sync/parker.rs --- a/crossbeam-utils/src/sync/parker.rs +++ b/crossbeam-utils/src/sync/parker.rs @@ -184,7 +184,7 @@ impl Parker { /// let raw = Parker::into_raw(p); /// # let _ = unsafe { Parker::from_raw(raw) }; /// ``` - pub fn into_raw(this: Parker) -> *const () { + pub fn into_raw(this: Self) -> *const () { Unparker::into_raw(this.unparker) } diff --git a/crossbeam-utils/src/sync/parker.rs b/crossbeam-utils/src/sync/parker.rs --- a/crossbeam-utils/src/sync/parker.rs +++ b/crossbeam-utils/src/sync/parker.rs @@ -203,8 +203,8 @@ impl Parker { /// let raw = Parker::into_raw(p); /// let p = unsafe { Parker::from_raw(raw) }; /// ``` - pub unsafe fn from_raw(ptr: *const ()) -> Parker { - Parker { + pub unsafe fn from_raw(ptr: *const ()) -> Self { + Self { unparker: Unparker::from_raw(ptr), _marker: PhantomData, } diff --git a/crossbeam-utils/src/sync/parker.rs b/crossbeam-utils/src/sync/parker.rs --- a/crossbeam-utils/src/sync/parker.rs +++ b/crossbeam-utils/src/sync/parker.rs @@ -270,7 +270,7 @@ impl Unparker { /// let raw = Unparker::into_raw(u); /// # let _ = unsafe { Unparker::from_raw(raw) }; /// ``` - pub fn into_raw(this: Unparker) -> *const () { + pub fn into_raw(this: Self) -> *const () { Arc::into_raw(this.inner).cast::<()>() } diff --git a/crossbeam-utils/src/sync/parker.rs b/crossbeam-utils/src/sync/parker.rs --- a/crossbeam-utils/src/sync/parker.rs +++ b/crossbeam-utils/src/sync/parker.rs @@ -291,8 +291,8 @@ impl Unparker { /// let raw = Unparker::into_raw(u); /// let u = unsafe { Unparker::from_raw(raw) }; /// ``` - pub unsafe fn from_raw(ptr: *const ()) -> Unparker { - Unparker { + pub unsafe fn from_raw(ptr: *const ()) -> Self { + Self { inner: Arc::from_raw(ptr.cast::<Inner>()), } } diff --git a/crossbeam-utils/src/sync/parker.rs b/crossbeam-utils/src/sync/parker.rs --- a/crossbeam-utils/src/sync/parker.rs +++ b/crossbeam-utils/src/sync/parker.rs @@ -305,8 +305,8 @@ impl fmt::Debug for Unparker { } impl Clone for Unparker { - fn clone(&self) -> Unparker { - Unparker { + fn clone(&self) -> Self { + Self { inner: self.inner.clone(), } } diff --git a/crossbeam-utils/src/sync/sharded_lock.rs b/crossbeam-utils/src/sync/sharded_lock.rs --- a/crossbeam-utils/src/sync/sharded_lock.rs +++ b/crossbeam-utils/src/sync/sharded_lock.rs @@ -97,8 +97,8 @@ impl<T> ShardedLock<T> { /// /// let lock = ShardedLock::new(5); /// ``` - pub fn new(value: T) -> ShardedLock<T> { - ShardedLock { + pub fn new(value: T) -> Self { + Self { shards: (0..NUM_SHARDS) .map(|_| { CachePadded::new(Shard { diff --git a/crossbeam-utils/src/sync/sharded_lock.rs b/crossbeam-utils/src/sync/sharded_lock.rs --- a/crossbeam-utils/src/sync/sharded_lock.rs +++ b/crossbeam-utils/src/sync/sharded_lock.rs @@ -468,14 +468,14 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for ShardedLock<T> { } impl<T: Default> Default for ShardedLock<T> { - fn default() -> ShardedLock<T> { - ShardedLock::new(Default::default()) + fn default() -> Self { + Self::new(Default::default()) } } impl<T> From<T> for ShardedLock<T> { fn from(t: T) -> Self { - ShardedLock::new(t) + Self::new(t) } } diff --git a/crossbeam-utils/src/sync/wait_group.rs b/crossbeam-utils/src/sync/wait_group.rs --- a/crossbeam-utils/src/sync/wait_group.rs +++ b/crossbeam-utils/src/sync/wait_group.rs @@ -128,11 +128,11 @@ impl Drop for WaitGroup { } impl Clone for WaitGroup { - fn clone(&self) -> WaitGroup { + fn clone(&self) -> Self { let mut count = self.inner.count.lock().unwrap(); *count += 1; - WaitGroup { + Self { inner: self.inner.clone(), } } diff --git a/crossbeam-utils/src/thread.rs b/crossbeam-utils/src/thread.rs --- a/crossbeam-utils/src/thread.rs +++ b/crossbeam-utils/src/thread.rs @@ -84,7 +84,7 @@ //! tricky because argument `s` lives *inside* the invocation of `thread::scope()` and as such //! cannot be borrowed by scoped threads: //! -//! ```compile_fail,E0373,E0521 +//! ```compile_fail,E0521 //! use crossbeam_utils::thread; //! //! thread::scope(|s| { diff --git a/crossbeam-utils/src/thread.rs b/crossbeam-utils/src/thread.rs --- a/crossbeam-utils/src/thread.rs +++ b/crossbeam-utils/src/thread.rs @@ -151,6 +151,15 @@ pub fn scope<'env, F, R>(f: F) -> thread::Result<R> where F: FnOnce(&Scope<'env>) -> R, { + struct AbortOnPanic; + impl Drop for AbortOnPanic { + fn drop(&mut self) { + if thread::panicking() { + std::process::abort(); + } + } + } + let wg = WaitGroup::new(); let scope = Scope::<'env> { handles: SharedVec::default(), diff --git a/crossbeam-utils/src/thread.rs b/crossbeam-utils/src/thread.rs --- a/crossbeam-utils/src/thread.rs +++ b/crossbeam-utils/src/thread.rs @@ -161,6 +170,10 @@ where // Execute the scoped function, but catch any panics. let result = panic::catch_unwind(panic::AssertUnwindSafe(|| f(&scope))); + // If an unwinding panic occurs before all threads are joined + // promote it to an aborting panic to prevent any threads from escaping the scope. + let guard = AbortOnPanic; + // Wait until all nested scopes are dropped. drop(scope.wait_group); wg.wait(); diff --git a/crossbeam-utils/src/thread.rs b/crossbeam-utils/src/thread.rs --- a/crossbeam-utils/src/thread.rs +++ b/crossbeam-utils/src/thread.rs @@ -176,6 +189,8 @@ where .filter_map(|handle| handle.join().err()) .collect(); + mem::forget(guard); + // If `f` has panicked, resume unwinding. // If any of the child threads have panicked, return the panic errors. // Otherwise, everything is OK and return the result of `f`.
crossbeam-rs/crossbeam
1,045
66617f6432e0ecd950da18d35e5d1f21fda6d3d9
Catch panics in critical section of thread::scope ### The problem The current implementation of the `scope` function for generating scoped threads contains a critical section: If an unwinding panic occurs after execution of the user-provided closure but before all scoped threads are successfully joined then a scoped thread may escape the scope. So we have to ensure that no unwinding panics can occur in this critical section. ### Can an unwinding panic occur in the critical section? Maybe? My investigation into this turned up some obvious candidates for panics, but it could be that they all are aborting panics: * The call to `wg.wait()` may panic on an integer overflow when internally calling `Arc::clone()`. Luckily, the panic is implemented as an aborting panic. * The call to `scope.handles.lock().unwrap()` may panic if the lock is poisoned. The only way I found to (theoretically) poison the lock is to cause an out-of-memory error. But we are lucky again, since out-of-memory errors themselves already cause aborting panics. * The call to `.collect()` at the end of the critical section may panic when trying to allocate a `Vec<_>`. To be honest I am not sure whether this can only cause aborting out-of-memory panics or whether there is some corner case where this would cause an unwinding panic. My concern here is that even if we are sure that this only causes aborting panics right now, can we be sure that this is also true for future versions of Rust? ### The proposed solution Just wrap the critical section in a `catch_unwind(..)` block that promotes unwinding panics to aborting panics until all scoped threads are successfully joined.
9e8596105bc9a6b343918b6ad1c9656dc24dc4f9
crossbeam-rs__crossbeam-1037
"cc https://github.com/rust-lang/rust/pull/117170#discussion_r1373230638\n> While the MSRV of crossb(...TRUNCATED)
2023-11-05T13:18:17Z
0.8
"diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml\n--- a/.github/workflows/ci.yml\n+(...TRUNCATED)
[ "1033" ]
"diff --git a/Cargo.toml b/Cargo.toml\n--- a/Cargo.toml\n+++ b/Cargo.toml\n@@ -6,7 +6,7 @@ name = \"(...TRUNCATED)
crossbeam-rs/crossbeam
1,037
9dd4c9594dd7c84abf04e89192f1bdfe790100f5
"Use cfg(target_has_atomic) instead of hard coding which targets support atomics\nThis has been stab(...TRUNCATED)
9e8596105bc9a6b343918b6ad1c9656dc24dc4f9
crossbeam-rs__crossbeam-1015
"This seems an instance of https://github.com/rust-lang/unsafe-code-guidelines/issues/69?\r\n\r\nI d(...TRUNCATED)
2023-08-13T21:28:50Z
0.8
"diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml\n--- a/.github/workflows/ci.yml\n+(...TRUNCATED)
[ "748" ]
"diff --git a/crossbeam-utils/build.rs b/crossbeam-utils/build.rs\n--- a/crossbeam-utils/build.rs\n+(...TRUNCATED)
crossbeam-rs/crossbeam
1,015
0761acfb85266fc71adc683071c22a0b3ca3cb10
"`AtomicCell` accessing uninitialized memory\nRun the follow code sample with `cargo +nightly miri r(...TRUNCATED)
9e8596105bc9a6b343918b6ad1c9656dc24dc4f9
crossbeam-rs__crossbeam-1012
"I have a working version of this feature in https://github.com/Lucretiel/crossbeam/tree/unpark-reas(...TRUNCATED)
2023-08-09T10:00:18Z
0.8
"diff --git a/crossbeam-utils/tests/parker.rs b/crossbeam-utils/tests/parker.rs\n--- a/crossbeam-uti(...TRUNCATED)
[ "601" ]
"diff --git a/crossbeam-utils/src/sync/mod.rs b/crossbeam-utils/src/sync/mod.rs\n--- a/crossbeam-uti(...TRUNCATED)
crossbeam-rs/crossbeam
1,012
03d68a2f211578b3cc5a8c899b9662fbe4dd6bc3
"Should park_timeout report the reason for their return (timeout or unpark)?\nThis originally is a b(...TRUNCATED)
9e8596105bc9a6b343918b6ad1c9656dc24dc4f9
crossbeam-rs__crossbeam-999
2023-06-17T13:41:25Z
0.8
"diff --git a/crossbeam-utils/tests/thread.rs b/crossbeam-utils/tests/thread.rs\n--- a/crossbeam-uti(...TRUNCATED)
[ "651" ]
"diff --git a/crossbeam-utils/src/thread.rs b/crossbeam-utils/src/thread.rs\n--- a/crossbeam-utils/s(...TRUNCATED)
crossbeam-rs/crossbeam
999
ce31c18607c44d3d07fc3618f981e858b35e3828
"Use own unix::JoinHandleExt trait\nThe standard library's extension traits are not intended to be i(...TRUNCATED)
9e8596105bc9a6b343918b6ad1c9656dc24dc4f9
crossbeam-rs__crossbeam-987
2023-06-12T16:28:36Z
0.8
"diff --git a/crossbeam-channel/tests/mpsc.rs b/crossbeam-channel/tests/mpsc.rs\n--- a/crossbeam-cha(...TRUNCATED)
[ "986" ]
"diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml\n--- a/.github/workflows/ci.yml\n+(...TRUNCATED)
crossbeam-rs/crossbeam
987
81ff802b19afc9e3ce37b822b3d5681f6e961cb7
"Publish new `crossbeam-epoch` with updated `memoffset`\nI see `memoffset` was updated to 0.9 in `cr(...TRUNCATED)
9e8596105bc9a6b343918b6ad1c9656dc24dc4f9
crossbeam-rs__crossbeam-964
2023-02-28T13:27:45Z
0.8
"diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml\n--- a/.github/workflows/ci.yml\n+(...TRUNCATED)
[ "918" ]
"diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml\n--- a/.github/workflows/ci.yml\n+(...TRUNCATED)
crossbeam-rs/crossbeam
964
366276a4dde8bd6b4bdab531c09e6ab1ff38c407
"atomic_cell::is_lock_free test fails on armv7-unknown-linux-gnueabihf\nBuilding crossbeam-utils 0.8(...TRUNCATED)
9e8596105bc9a6b343918b6ad1c9656dc24dc4f9
crossbeam-rs__crossbeam-936
"\r\n> Looks like the assumptions made in this test aren't correct on 32-bit ARM?\r\n\r\nyeah, arm's(...TRUNCATED)
2022-12-03T08:02:48Z
0.8
"diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml\n--- a/.github/workflows/ci.yml\n+(...TRUNCATED)
[ "918" ]
"diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml\n--- a/.github/workflows/ci.yml\n+(...TRUNCATED)
crossbeam-rs/crossbeam
936
42ad5f704dbdbdc54462a076f0fe6172acdcf772
"atomic_cell::is_lock_free test fails on armv7-unknown-linux-gnueabihf\nBuilding crossbeam-utils 0.8(...TRUNCATED)
9e8596105bc9a6b343918b6ad1c9656dc24dc4f9
crossbeam-rs__crossbeam-929
2022-11-20T07:55:38Z
0.8
"diff --git a/crossbeam-epoch/Cargo.toml b/crossbeam-epoch/Cargo.toml\n--- a/crossbeam-epoch/Cargo.t(...TRUNCATED)
[ "928" ]
"diff --git /dev/null b/build-common.rs\nnew file mode 100644\n--- /dev/null\n+++ b/build-common.rs\(...TRUNCATED)
crossbeam-rs/crossbeam
929
71dd4cace6e0e212dadcafb93170d4fa0a8ba2dc
"can you please cut a point release with PR #922 included?\nhey everyone, \r\n\r\nPR #922 will most (...TRUNCATED)
9e8596105bc9a6b343918b6ad1c9656dc24dc4f9
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
1