Skip to content

Commit

Permalink
Merge #875 #876
Browse files Browse the repository at this point in the history
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 <te316e89@gmail.com>
  • Loading branch information
bors[bot] and taiki-e committed Jul 22, 2022
3 parents 6baa072 + 371de8c + 8262385 commit 99b14b1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions ci/miri.sh
Expand Up @@ -9,8 +9,7 @@ echo

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

# -Zmiri-ignore-leaks is needed because we use detached threads in tests/docs: https://github.com/rust-lang/miri/issues/1371
MIRIFLAGS="-Zmiri-symbolic-alignment-check -Zmiri-disable-isolation -Zmiri-ignore-leaks" \
MIRIFLAGS="-Zmiri-symbolic-alignment-check -Zmiri-disable-isolation" \
cargo miri test \
-p crossbeam-queue \
-p crossbeam-utils 2>&1 | ts -i '%.s '
Expand Down
2 changes: 1 addition & 1 deletion crossbeam-epoch/src/atomic.rs
Expand Up @@ -1712,7 +1712,7 @@ mod tests {
#[test]
fn array_init() {
let owned = Owned::<[MaybeUninit<usize>]>::init(10);
let arr: &[MaybeUninit<usize>] = &*owned;
let arr: &[MaybeUninit<usize>] = &owned;
assert_eq!(arr.len(), 10);
}
}
2 changes: 1 addition & 1 deletion crossbeam-skiplist/src/base.rs
Expand Up @@ -1042,7 +1042,7 @@ where
}

// Installation failed. Decrement the reference count.
(*n).refs_and_height
n.refs_and_height
.fetch_sub(1 << HEIGHT_BITS, Ordering::Relaxed);

// We don't have the most up-to-date search results. Repeat the search.
Expand Down
2 changes: 2 additions & 0 deletions crossbeam-utils/src/backoff.rs
Expand Up @@ -201,6 +201,7 @@ impl Backoff {
/// assert_eq!(ready.load(SeqCst), false);
/// spin_wait(&ready);
/// assert_eq!(ready.load(SeqCst), true);
/// # std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
/// ```
///
/// [`AtomicBool`]: std::sync::atomic::AtomicBool
Expand Down Expand Up @@ -269,6 +270,7 @@ impl Backoff {
/// assert_eq!(ready.load(SeqCst), false);
/// blocking_wait(&ready);
/// assert_eq!(ready.load(SeqCst), true);
/// # std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
/// ```
///
/// [`AtomicBool`]: std::sync::atomic::AtomicBool
Expand Down
2 changes: 2 additions & 0 deletions crossbeam-utils/src/sync/parker.rs
Expand Up @@ -44,6 +44,7 @@ use std::time::{Duration, Instant};
///
/// // Wakes up when `u.unpark()` provides the token.
/// p.park();
/// # std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
/// ```
///
/// [`park`]: Parker::park
Expand Down Expand Up @@ -241,6 +242,7 @@ impl Unparker {
///
/// // Wakes up when `u.unpark()` provides the token.
/// p.park();
/// # std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
/// ```
///
/// [`park`]: Parker::park
Expand Down

0 comments on commit 99b14b1

Please sign in to comment.