Skip to content

Commit 99b14b1

Browse files
bors[bot]taiki-e
andauthored
Merge #875 #876
875: Miri: Fix thread leaks in doctests in utils r=taiki-e a=taiki-e 876: Fix clippy::explicit_auto_deref warning r=taiki-e a=taiki-e ``` warning: deref which would be done by auto-deref --> crossbeam-epoch/src/atomic.rs:1715:43 | 1715 | let arr: &[MaybeUninit<usize>] = &*owned; | ^^^^^^ help: try this: `owned` | = note: `#[warn(clippy::explicit_auto_deref)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref warning: deref which would be done by auto-deref --> crossbeam-skiplist/src/base.rs:1045:21 | 1045 | (*n).refs_and_height | ^^^^ help: try this: `n` | = note: `#[warn(clippy::explicit_auto_deref)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref ``` Co-authored-by: Taiki Endo <[email protected]>
3 parents 6baa072 + 371de8c + 8262385 commit 99b14b1

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

ci/miri.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ echo
99

1010
export RUSTFLAGS="${RUSTFLAGS:-} -Z randomize-layout"
1111

12-
# -Zmiri-ignore-leaks is needed because we use detached threads in tests/docs: https://github.com/rust-lang/miri/issues/1371
13-
MIRIFLAGS="-Zmiri-symbolic-alignment-check -Zmiri-disable-isolation -Zmiri-ignore-leaks" \
12+
MIRIFLAGS="-Zmiri-symbolic-alignment-check -Zmiri-disable-isolation" \
1413
cargo miri test \
1514
-p crossbeam-queue \
1615
-p crossbeam-utils 2>&1 | ts -i '%.s '

crossbeam-epoch/src/atomic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,7 @@ mod tests {
17121712
#[test]
17131713
fn array_init() {
17141714
let owned = Owned::<[MaybeUninit<usize>]>::init(10);
1715-
let arr: &[MaybeUninit<usize>] = &*owned;
1715+
let arr: &[MaybeUninit<usize>] = &owned;
17161716
assert_eq!(arr.len(), 10);
17171717
}
17181718
}

crossbeam-skiplist/src/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ where
10421042
}
10431043

10441044
// Installation failed. Decrement the reference count.
1045-
(*n).refs_and_height
1045+
n.refs_and_height
10461046
.fetch_sub(1 << HEIGHT_BITS, Ordering::Relaxed);
10471047

10481048
// We don't have the most up-to-date search results. Repeat the search.

crossbeam-utils/src/backoff.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ impl Backoff {
201201
/// assert_eq!(ready.load(SeqCst), false);
202202
/// spin_wait(&ready);
203203
/// assert_eq!(ready.load(SeqCst), true);
204+
/// # std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
204205
/// ```
205206
///
206207
/// [`AtomicBool`]: std::sync::atomic::AtomicBool
@@ -269,6 +270,7 @@ impl Backoff {
269270
/// assert_eq!(ready.load(SeqCst), false);
270271
/// blocking_wait(&ready);
271272
/// assert_eq!(ready.load(SeqCst), true);
273+
/// # std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
272274
/// ```
273275
///
274276
/// [`AtomicBool`]: std::sync::atomic::AtomicBool

crossbeam-utils/src/sync/parker.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ use std::time::{Duration, Instant};
4444
///
4545
/// // Wakes up when `u.unpark()` provides the token.
4646
/// p.park();
47+
/// # std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
4748
/// ```
4849
///
4950
/// [`park`]: Parker::park
@@ -241,6 +242,7 @@ impl Unparker {
241242
///
242243
/// // Wakes up when `u.unpark()` provides the token.
243244
/// p.park();
245+
/// # std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
244246
/// ```
245247
///
246248
/// [`park`]: Parker::park

0 commit comments

Comments
 (0)