Skip to content

Commit 80224bc

Browse files
bors[bot]cbeuwalygin
authored
Merge #831 #832
831: Add spin loop hints in tests for Miri r=taiki-e a=cbeuw This is a better way to do #829 Miri does not have a pre-emptive scheduler, so once the execution falls into a spin loop it'll hang forever: rust-lang/miri#1388 Similar measures (`yield_now()`) are already present in [some other tests](https://github.com/crossbeam-rs/crossbeam/blob/master/crossbeam-queue/tests/array_queue.rs), but it's missing here 832: Fix links to macro rules in docs r=taiki-e a=alygin The fix provides explicit links to macro rules in docs because they [are not resolved globally anymore](rust-lang/rust#96676). Co-authored-by: Andy Wang <cbeuw.andy@gmail.com> Co-authored-by: Andrew Lygin <alygin@gmail.com>
3 parents 6f52bea + ba07864 + 8eff2a4 commit 80224bc

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

crossbeam-channel/src/channel.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ pub fn at(when: Instant) -> Receiver<Instant> {
233233
///
234234
/// Using a `never` channel to optionally add a timeout to [`select!`]:
235235
///
236+
/// [`select!`]: crate::select!
237+
///
236238
/// ```
237239
/// use std::thread;
238240
/// use std::time::Duration;

crossbeam-channel/src/select.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,8 @@ pub(crate) fn select_deadline<'a>(
519519
/// The [`select!`] macro is a convenience wrapper around `Select`. However, it cannot select over a
520520
/// dynamically created list of channel operations.
521521
///
522+
/// [`select!`]: crate::select!
523+
///
522524
/// Once a list of operations has been built with `Select`, there are two different ways of
523525
/// proceeding:
524526
///

crossbeam-channel/src/select_macro.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ macro_rules! crossbeam_channel_internal {
993993
/// An operation is considered to be ready if it doesn't have to block. Note that it is ready even
994994
/// when it will simply return an error because the channel is disconnected.
995995
///
996-
/// The `select` macro is a convenience wrapper around [`Select`]. However, it cannot select over a
996+
/// The `select!` macro is a convenience wrapper around [`Select`]. However, it cannot select over a
997997
/// dynamically created list of channel operations.
998998
///
999999
/// [`Select`]: super::Select

crossbeam-deque/tests/injector.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ fn spsc() {
6161
assert_eq!(i, v);
6262
break;
6363
}
64+
#[cfg(miri)]
65+
std::hint::spin_loop();
6466
}
6567
}
6668

@@ -102,6 +104,8 @@ fn mpmc() {
102104
v[n].fetch_add(1, SeqCst);
103105
break;
104106
}
107+
#[cfg(miri)]
108+
std::hint::spin_loop();
105109
}
106110
}
107111
});

crossbeam-deque/tests/lifo.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ fn spsc() {
8787
assert_eq!(i, v);
8888
break;
8989
}
90+
#[cfg(miri)]
91+
std::hint::spin_loop();
9092
}
9193
}
9294

0 commit comments

Comments
 (0)