From ba078648fb90dcd326c175caba1caef290de749a Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Tue, 17 May 2022 21:11:37 +0100 Subject: [PATCH 1/3] Add spin loop hints for Miri --- crossbeam-deque/tests/injector.rs | 4 ++++ crossbeam-deque/tests/lifo.rs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/crossbeam-deque/tests/injector.rs b/crossbeam-deque/tests/injector.rs index 478f7ee87..f706a8d9c 100644 --- a/crossbeam-deque/tests/injector.rs +++ b/crossbeam-deque/tests/injector.rs @@ -61,6 +61,8 @@ fn spsc() { assert_eq!(i, v); break; } + #[cfg(miri)] + std::hint::spin_loop(); } } @@ -102,6 +104,8 @@ fn mpmc() { v[n].fetch_add(1, SeqCst); break; } + #[cfg(miri)] + std::hint::spin_loop(); } } }); diff --git a/crossbeam-deque/tests/lifo.rs b/crossbeam-deque/tests/lifo.rs index ce04c6159..c1a65cd2e 100644 --- a/crossbeam-deque/tests/lifo.rs +++ b/crossbeam-deque/tests/lifo.rs @@ -87,6 +87,8 @@ fn spsc() { assert_eq!(i, v); break; } + #[cfg(miri)] + std::hint::spin_loop(); } } From a5e6b122015111ec08d4d3a88b905115bdff4735 Mon Sep 17 00:00:00 2001 From: Andrew Lygin Date: Thu, 19 May 2022 19:41:57 +0300 Subject: [PATCH 2/3] Fix links to macro rules in doc --- crossbeam-channel/src/channel.rs | 2 ++ crossbeam-channel/src/select.rs | 2 ++ crossbeam-channel/src/select_macro.rs | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crossbeam-channel/src/channel.rs b/crossbeam-channel/src/channel.rs index 27423b7e7..5196677a5 100644 --- a/crossbeam-channel/src/channel.rs +++ b/crossbeam-channel/src/channel.rs @@ -232,6 +232,8 @@ pub fn at(when: Instant) -> Receiver { /// # Examples /// /// Using a `never` channel to optionally add a timeout to [`select!`]: +/// +/// [`select!`]: crate::select! /// /// ``` /// use std::thread; diff --git a/crossbeam-channel/src/select.rs b/crossbeam-channel/src/select.rs index 710b61221..70e89067d 100644 --- a/crossbeam-channel/src/select.rs +++ b/crossbeam-channel/src/select.rs @@ -518,6 +518,8 @@ pub(crate) fn select_deadline<'a>( /// /// The [`select!`] macro is a convenience wrapper around `Select`. However, it cannot select over a /// dynamically created list of channel operations. +/// +/// [`select!`]: crate::select! /// /// Once a list of operations has been built with `Select`, there are two different ways of /// proceeding: diff --git a/crossbeam-channel/src/select_macro.rs b/crossbeam-channel/src/select_macro.rs index 0a609573e..efe0ae406 100644 --- a/crossbeam-channel/src/select_macro.rs +++ b/crossbeam-channel/src/select_macro.rs @@ -993,7 +993,7 @@ macro_rules! crossbeam_channel_internal { /// An operation is considered to be ready if it doesn't have to block. Note that it is ready even /// when it will simply return an error because the channel is disconnected. /// -/// The `select` macro is a convenience wrapper around [`Select`]. However, it cannot select over a +/// The `select!` macro is a convenience wrapper around [`Select`]. However, it cannot select over a /// dynamically created list of channel operations. /// /// [`Select`]: super::Select From 8eff2a458f606c479393181cec364cdb55d2b28f Mon Sep 17 00:00:00 2001 From: Andrew Lygin Date: Thu, 19 May 2022 19:53:35 +0300 Subject: [PATCH 3/3] Fix formatting --- crossbeam-channel/src/channel.rs | 2 +- crossbeam-channel/src/select.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crossbeam-channel/src/channel.rs b/crossbeam-channel/src/channel.rs index 5196677a5..800fe6352 100644 --- a/crossbeam-channel/src/channel.rs +++ b/crossbeam-channel/src/channel.rs @@ -232,7 +232,7 @@ pub fn at(when: Instant) -> Receiver { /// # Examples /// /// Using a `never` channel to optionally add a timeout to [`select!`]: -/// +/// /// [`select!`]: crate::select! /// /// ``` diff --git a/crossbeam-channel/src/select.rs b/crossbeam-channel/src/select.rs index 70e89067d..57d67a3a1 100644 --- a/crossbeam-channel/src/select.rs +++ b/crossbeam-channel/src/select.rs @@ -518,7 +518,7 @@ pub(crate) fn select_deadline<'a>( /// /// The [`select!`] macro is a convenience wrapper around `Select`. However, it cannot select over a /// dynamically created list of channel operations. -/// +/// /// [`select!`]: crate::select! /// /// Once a list of operations has been built with `Select`, there are two different ways of