From 5b5d727fcd2616b1f5314db03f4e6b96791a303d Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 15 Oct 2019 23:07:30 +0900 Subject: [PATCH 1/7] Fix breakage with nightly feature --- crossbeam-epoch/src/lib.rs | 5 +---- crossbeam-skiplist/src/lib.rs | 5 +---- crossbeam-utils/src/lib.rs | 5 +---- src/lib.rs | 5 +---- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/crossbeam-epoch/src/lib.rs b/crossbeam-epoch/src/lib.rs index e3116dcf7..112180b25 100644 --- a/crossbeam-epoch/src/lib.rs +++ b/crossbeam-epoch/src/lib.rs @@ -73,10 +73,7 @@ cfg_if! { } } -#[cfg_attr( - feature = "nightly", - cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr")) -)] +#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))] cfg_if! { if #[cfg(any(feature = "alloc", feature = "std"))] { extern crate crossbeam_utils; diff --git a/crossbeam-skiplist/src/lib.rs b/crossbeam-skiplist/src/lib.rs index 942b0a9d8..17e4a7bfb 100644 --- a/crossbeam-skiplist/src/lib.rs +++ b/crossbeam-skiplist/src/lib.rs @@ -18,10 +18,7 @@ cfg_if! { } } -#[cfg_attr( - feature = "nightly", - cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr")) -)] +#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))] cfg_if! { if #[cfg(any(feature = "alloc", feature = "std"))] { extern crate crossbeam_epoch as epoch; diff --git a/crossbeam-utils/src/lib.rs b/crossbeam-utils/src/lib.rs index 4df2ac8a4..06f23beb4 100644 --- a/crossbeam-utils/src/lib.rs +++ b/crossbeam-utils/src/lib.rs @@ -44,10 +44,7 @@ cfg_if! { } } -#[cfg_attr( - feature = "nightly", - cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr")) -)] +#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))] pub mod atomic; mod cache_padded; diff --git a/src/lib.rs b/src/lib.rs index ecff332ee..01c5a8fde 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -68,10 +68,7 @@ pub use _epoch::crossbeam_epoch as epoch; extern crate crossbeam_utils; -#[cfg_attr( - feature = "nightly", - cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr")) -)] +#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))] pub use crossbeam_utils::atomic; /// Miscellaneous utilities. From b2e6cf83366512d1d0e369b757b855d95887e91a Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 16 Oct 2019 01:13:07 +0900 Subject: [PATCH 2/7] Downgrade dependencies on minimum versions build --- .travis.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.travis.yml b/.travis.yml index c8d5312d5..93f5ded73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -90,3 +90,18 @@ matrix: - rust: stable name: "rustfmt" script: ./ci/rustfmt.sh + +before_script: + # lazy_static 1.4.0 requires Rust 1.27+ + # and cfg-if 0.1.10 requires Rust 1.31+ so downgrade it. + - | + if [[ "$TRAVIS_RUST_VERSION" == "1.26.0" ]]; then + cargo generate-lockfile + cargo update -p cfg-if --precise 0.1.9 + cargo update -p lazy_static --precise 1.3.0 + fi + - | + if [[ "$TRAVIS_RUST_VERSION" == "1.28.0" ]]; then + cargo generate-lockfile + cargo update -p cfg-if --precise 0.1.9 + fi From e3fa197270392123ee4bbe9c64036e8fc0d25a7e Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 16 Oct 2019 20:55:18 +0900 Subject: [PATCH 3/7] Drop support for 1.26 and 1.27 --- .travis.yml | 25 +++++++++---------------- crossbeam-channel/README.md | 2 +- crossbeam-epoch/README.md | 2 +- crossbeam-queue/README.md | 4 ++-- crossbeam-utils/README.md | 2 +- 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 93f5ded73..2cbe1f05e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,23 +16,23 @@ matrix: - rust: 1.28.0 name: "crossbeam on 1.28.0" script: ./ci/crossbeam.sh - - rust: 1.26.0 - name: "crossbeam-channel on 1.26.0" + - rust: 1.28.0 + name: "crossbeam-channel on 1.28.0" script: ./ci/crossbeam-channel.sh - rust: 1.28.0 name: "crossbeam-deque on 1.28.0" script: ./ci/crossbeam-deque.sh - - rust: 1.26.0 - name: "crossbeam-epoch on 1.26.0" + - rust: 1.28.0 + name: "crossbeam-epoch on 1.28.0" script: ./ci/crossbeam-epoch.sh - - rust: 1.26.0 - name: "crossbeam-queue on 1.26.0" + - rust: 1.28.0 + name: "crossbeam-queue on 1.28.0" script: ./ci/crossbeam-queue.sh - rust: 1.28.0 name: "crossbeam-skiplist on 1.28.0" script: ./ci/crossbeam-skiplist.sh - - rust: 1.26.0 - name: "crossbeam-utils on 1.26.0" + - rust: 1.28.0 + name: "crossbeam-utils on 1.28.0" script: ./ci/crossbeam-utils.sh # Test crates on nightly Rust. @@ -92,14 +92,7 @@ matrix: script: ./ci/rustfmt.sh before_script: - # lazy_static 1.4.0 requires Rust 1.27+ - # and cfg-if 0.1.10 requires Rust 1.31+ so downgrade it. - - | - if [[ "$TRAVIS_RUST_VERSION" == "1.26.0" ]]; then - cargo generate-lockfile - cargo update -p cfg-if --precise 0.1.9 - cargo update -p lazy_static --precise 1.3.0 - fi + # cfg-if 0.1.10 requires Rust 1.31+ so downgrade it. - | if [[ "$TRAVIS_RUST_VERSION" == "1.28.0" ]]; then cargo generate-lockfile diff --git a/crossbeam-channel/README.md b/crossbeam-channel/README.md index 2e16a046c..a5187fca5 100644 --- a/crossbeam-channel/README.md +++ b/crossbeam-channel/README.md @@ -8,7 +8,7 @@ https://github.com/crossbeam-rs/crossbeam-channel) https://crates.io/crates/crossbeam-channel) [![Documentation](https://docs.rs/crossbeam-channel/badge.svg)]( https://docs.rs/crossbeam-channel) -[![Rust 1.26+](https://img.shields.io/badge/rust-1.26+-lightgray.svg)]( +[![Rust 1.28+](https://img.shields.io/badge/rust-1.28+-lightgray.svg)]( https://www.rust-lang.org) [![chat](https://img.shields.io/discord/569610676205781012.svg?logo=discord)](https://discord.gg/BBYwKq) diff --git a/crossbeam-epoch/README.md b/crossbeam-epoch/README.md index a1fb4141c..baa185110 100644 --- a/crossbeam-epoch/README.md +++ b/crossbeam-epoch/README.md @@ -8,7 +8,7 @@ https://github.com/crossbeam-rs/crossbeam-epoch) https://crates.io/crates/crossbeam-epoch) [![Documentation](https://docs.rs/crossbeam-epoch/badge.svg)]( https://docs.rs/crossbeam-epoch) -[![Rust 1.26+](https://img.shields.io/badge/rust-1.26+-lightgray.svg)]( +[![Rust 1.28+](https://img.shields.io/badge/rust-1.28+-lightgray.svg)]( https://www.rust-lang.org) [![chat](https://img.shields.io/discord/569610676205781012.svg?logo=discord)](https://discord.gg/BBYwKq) diff --git a/crossbeam-queue/README.md b/crossbeam-queue/README.md index 11228c0f4..292989a88 100644 --- a/crossbeam-queue/README.md +++ b/crossbeam-queue/README.md @@ -8,7 +8,7 @@ https://github.com/crossbeam-rs/crossbeam-queue/tree/master/src) https://crates.io/crates/crossbeam-queue) [![Documentation](https://docs.rs/crossbeam-queue/badge.svg)]( https://docs.rs/crossbeam-queue) -[![Rust 1.26+](https://img.shields.io/badge/rust-1.26+-lightgray.svg)]( +[![Rust 1.28+](https://img.shields.io/badge/rust-1.28+-lightgray.svg)]( https://www.rust-lang.org) [![chat](https://img.shields.io/discord/569610676205781012.svg?logo=discord)](https://discord.gg/BBYwKq) @@ -37,7 +37,7 @@ extern crate crossbeam_queue; ## Compatibility -The minimum supported Rust version is 1.26. +The minimum supported Rust version is 1.28. ## License diff --git a/crossbeam-utils/README.md b/crossbeam-utils/README.md index b4a0f6b20..640575189 100644 --- a/crossbeam-utils/README.md +++ b/crossbeam-utils/README.md @@ -8,7 +8,7 @@ https://github.com/crossbeam-rs/crossbeam-utils/tree/master/src) https://crates.io/crates/crossbeam-utils) [![Documentation](https://docs.rs/crossbeam-utils/badge.svg)]( https://docs.rs/crossbeam-utils) -[![Rust 1.26+](https://img.shields.io/badge/rust-1.26+-lightgray.svg)]( +[![Rust 1.28+](https://img.shields.io/badge/rust-1.28+-lightgray.svg)]( https://www.rust-lang.org) [![chat](https://img.shields.io/discord/569610676205781012.svg?logo=discord)](https://discord.gg/BBYwKq) From 5d69fab5f34b818e8f09bb4bf9f3b8a7f2a610fb Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 16 Oct 2019 21:02:55 +0900 Subject: [PATCH 4/7] Revert "Allow warnings on nightly" This reverts commit eae3589e414f3e174583d5604b65f683c314e0be. --- ci/crossbeam-channel.sh | 4 +--- ci/crossbeam-deque.sh | 4 +--- ci/crossbeam-epoch.sh | 4 +--- ci/crossbeam-queue.sh | 4 +--- ci/crossbeam-skiplist.sh | 4 +--- ci/crossbeam-utils.sh | 4 +--- ci/crossbeam.sh | 4 +--- 7 files changed, 7 insertions(+), 21 deletions(-) diff --git a/ci/crossbeam-channel.sh b/ci/crossbeam-channel.sh index f40cf9ab4..b21e65544 100755 --- a/ci/crossbeam-channel.sh +++ b/ci/crossbeam-channel.sh @@ -3,9 +3,7 @@ cd "$(dirname "$0")"/../crossbeam-channel set -ex -if [[ "$TRAVIS_RUST_VERSION" != "nightly" ]]; then - export RUSTFLAGS="-D warnings" -fi +export RUSTFLAGS="-D warnings" cargo check --bins --examples --tests cargo test -- --test-threads=1 diff --git a/ci/crossbeam-deque.sh b/ci/crossbeam-deque.sh index c647fece3..66c9b1f7e 100755 --- a/ci/crossbeam-deque.sh +++ b/ci/crossbeam-deque.sh @@ -3,9 +3,7 @@ cd "$(dirname "$0")"/../crossbeam-deque set -ex -if [[ "$TRAVIS_RUST_VERSION" != "nightly" ]]; then - export RUSTFLAGS="-D warnings" -fi +export RUSTFLAGS="-D warnings" cargo check --bins --examples --tests cargo test diff --git a/ci/crossbeam-epoch.sh b/ci/crossbeam-epoch.sh index 6cd677553..3f18e3148 100755 --- a/ci/crossbeam-epoch.sh +++ b/ci/crossbeam-epoch.sh @@ -3,9 +3,7 @@ cd "$(dirname "$0")"/../crossbeam-epoch set -ex -if [[ "$TRAVIS_RUST_VERSION" != "nightly" ]]; then - export RUSTFLAGS="-D warnings" -fi +export RUSTFLAGS="-D warnings" cargo check --no-default-features cargo check --bins --examples --tests diff --git a/ci/crossbeam-queue.sh b/ci/crossbeam-queue.sh index 873bfe414..d11faeccf 100755 --- a/ci/crossbeam-queue.sh +++ b/ci/crossbeam-queue.sh @@ -3,9 +3,7 @@ cd "$(dirname "$0")"/../crossbeam-queue set -ex -if [[ "$TRAVIS_RUST_VERSION" != "nightly" ]]; then - export RUSTFLAGS="-D warnings" -fi +export RUSTFLAGS="-D warnings" cargo check --bins --examples --tests cargo test diff --git a/ci/crossbeam-skiplist.sh b/ci/crossbeam-skiplist.sh index f2d9208e2..3232a1f14 100755 --- a/ci/crossbeam-skiplist.sh +++ b/ci/crossbeam-skiplist.sh @@ -3,9 +3,7 @@ cd "$(dirname "$0")"/../crossbeam-skiplist set -ex -if [[ "$TRAVIS_RUST_VERSION" != "nightly" ]]; then - export RUSTFLAGS="-D warnings" -fi +export RUSTFLAGS="-D warnings" cargo check --no-default-features cargo check --bins --examples --tests diff --git a/ci/crossbeam-utils.sh b/ci/crossbeam-utils.sh index 2c9840a8d..3095ea9e5 100755 --- a/ci/crossbeam-utils.sh +++ b/ci/crossbeam-utils.sh @@ -3,9 +3,7 @@ cd "$(dirname "$0")"/../crossbeam-utils set -ex -if [[ "$TRAVIS_RUST_VERSION" != "nightly" ]]; then - export RUSTFLAGS="-D warnings" -fi +export RUSTFLAGS="-D warnings" cargo check --no-default-features cargo check --bins --examples --tests diff --git a/ci/crossbeam.sh b/ci/crossbeam.sh index 06910b052..24e1739c8 100755 --- a/ci/crossbeam.sh +++ b/ci/crossbeam.sh @@ -3,9 +3,7 @@ cd "$(dirname "$0")"/.. set -ex -if [[ "$TRAVIS_RUST_VERSION" != "nightly" ]]; then - export RUSTFLAGS="-D warnings" -fi +export RUSTFLAGS="-D warnings" cargo check --no-default-features cargo check --bins --examples --tests From 4d952ef786292a12e86aaacbdc08fede12054232 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 16 Oct 2019 21:09:35 +0900 Subject: [PATCH 5/7] Fix bare_trait_objects warnings --- crossbeam-channel/src/err.rs | 16 ++++++++-------- crossbeam-channel/src/select.rs | 24 ++++++++++++------------ crossbeam-channel/tests/array.rs | 2 +- crossbeam-channel/tests/golang.rs | 2 +- crossbeam-channel/tests/list.rs | 2 +- crossbeam-channel/tests/ready.rs | 2 +- crossbeam-channel/tests/select.rs | 2 +- crossbeam-channel/tests/select_macro.rs | 2 +- crossbeam-channel/tests/zero.rs | 2 +- crossbeam-utils/src/thread.rs | 4 ++-- crossbeam-utils/tests/thread.rs | 4 ++-- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/crossbeam-channel/src/err.rs b/crossbeam-channel/src/err.rs index 02c7d44f4..468ce5cd8 100644 --- a/crossbeam-channel/src/err.rs +++ b/crossbeam-channel/src/err.rs @@ -132,7 +132,7 @@ impl error::Error for SendError { "sending on a disconnected channel" } - fn cause(&self) -> Option<&error::Error> { + fn cause(&self) -> Option<&dyn error::Error> { None } } @@ -183,7 +183,7 @@ impl error::Error for TrySendError { } } - fn cause(&self) -> Option<&error::Error> { + fn cause(&self) -> Option<&dyn error::Error> { None } } @@ -254,7 +254,7 @@ impl error::Error for SendTimeoutError { "sending on an empty and disconnected channel" } - fn cause(&self) -> Option<&error::Error> { + fn cause(&self) -> Option<&dyn error::Error> { None } } @@ -317,7 +317,7 @@ impl error::Error for RecvError { "receiving on an empty and disconnected channel" } - fn cause(&self) -> Option<&error::Error> { + fn cause(&self) -> Option<&dyn error::Error> { None } } @@ -339,7 +339,7 @@ impl error::Error for TryRecvError { } } - fn cause(&self) -> Option<&error::Error> { + fn cause(&self) -> Option<&dyn error::Error> { None } } @@ -387,7 +387,7 @@ impl error::Error for RecvTimeoutError { } } - fn cause(&self) -> Option<&error::Error> { + fn cause(&self) -> Option<&dyn error::Error> { None } } @@ -429,7 +429,7 @@ impl error::Error for TrySelectError { "all operations in select would block" } - fn cause(&self) -> Option<&error::Error> { + fn cause(&self) -> Option<&dyn error::Error> { None } } @@ -445,7 +445,7 @@ impl error::Error for SelectTimeoutError { "timed out waiting on select" } - fn cause(&self) -> Option<&error::Error> { + fn cause(&self) -> Option<&dyn error::Error> { None } } diff --git a/crossbeam-channel/src/select.rs b/crossbeam-channel/src/select.rs index a586c6bc1..b5adf29d2 100644 --- a/crossbeam-channel/src/select.rs +++ b/crossbeam-channel/src/select.rs @@ -171,7 +171,7 @@ enum Timeout { /// Successful receive operations will have to be followed up by `channel::read()` and successful /// send operations by `channel::write()`. fn run_select( - handles: &mut [(&SelectHandle, usize, *const u8)], + handles: &mut [(&dyn SelectHandle, usize, *const u8)], timeout: Timeout, ) -> Option<(Token, usize, *const u8)> { if handles.is_empty() { @@ -220,7 +220,7 @@ fn run_select( registered_count += 1; // If registration returns `false`, that means the operation has just become ready. - if handle.register(Operation::hook::<&SelectHandle>(handle), cx) { + if handle.register(Operation::hook::<&dyn SelectHandle>(handle), cx) { // Try aborting select. sel = match cx.try_select(Selected::Aborted) { Ok(()) => { @@ -259,7 +259,7 @@ fn run_select( // Unregister all registered operations. for (handle, _, _) in handles.iter_mut().take(registered_count) { - handle.unregister(Operation::hook::<&SelectHandle>(handle)); + handle.unregister(Operation::hook::<&dyn SelectHandle>(handle)); } match sel { @@ -279,7 +279,7 @@ fn run_select( // Find the selected operation. for (handle, i, ptr) in handles.iter_mut() { // Is this the selected operation? - if sel == Selected::Operation(Operation::hook::<&SelectHandle>(handle)) { + if sel == Selected::Operation(Operation::hook::<&dyn SelectHandle>(handle)) { // Try selecting this operation. if handle.accept(&mut token, cx) { return Some((*i, *ptr)); @@ -317,7 +317,7 @@ fn run_select( } /// Runs until one of the operations becomes ready, potentially blocking the current thread. -fn run_ready(handles: &mut [(&SelectHandle, usize, *const u8)], timeout: Timeout) -> Option { +fn run_ready(handles: &mut [(&dyn SelectHandle, usize, *const u8)], timeout: Timeout) -> Option { if handles.is_empty() { // Wait until the timeout and return. match timeout { @@ -372,7 +372,7 @@ fn run_ready(handles: &mut [(&SelectHandle, usize, *const u8)], timeout: Timeout // Begin watching all operations. for (handle, _, _) in handles.iter_mut() { registered_count += 1; - let oper = Operation::hook::<&SelectHandle>(handle); + let oper = Operation::hook::<&dyn SelectHandle>(handle); // If registration returns `false`, that means the operation has just become ready. if handle.watch(oper, cx) { @@ -410,7 +410,7 @@ fn run_ready(handles: &mut [(&SelectHandle, usize, *const u8)], timeout: Timeout // Unwatch all operations. for (handle, _, _) in handles.iter_mut().take(registered_count) { - handle.unwatch(Operation::hook::<&SelectHandle>(handle)); + handle.unwatch(Operation::hook::<&dyn SelectHandle>(handle)); } match sel { @@ -419,7 +419,7 @@ fn run_ready(handles: &mut [(&SelectHandle, usize, *const u8)], timeout: Timeout Selected::Disconnected => {} Selected::Operation(_) => { for (handle, i, _) in handles.iter_mut() { - let oper = Operation::hook::<&SelectHandle>(handle); + let oper = Operation::hook::<&dyn SelectHandle>(handle); if sel == Selected::Operation(oper) { return Some(*i); } @@ -440,7 +440,7 @@ fn run_ready(handles: &mut [(&SelectHandle, usize, *const u8)], timeout: Timeout /// Attempts to select one of the operations without blocking. #[inline] pub fn try_select<'a>( - handles: &mut [(&'a SelectHandle, usize, *const u8)], + handles: &mut [(&'a dyn SelectHandle, usize, *const u8)], ) -> Result, TrySelectError> { match run_select(handles, Timeout::Now) { None => Err(TrySelectError), @@ -455,7 +455,7 @@ pub fn try_select<'a>( /// Blocks until one of the operations becomes ready and selects it. #[inline] -pub fn select<'a>(handles: &mut [(&'a SelectHandle, usize, *const u8)]) -> SelectedOperation<'a> { +pub fn select<'a>(handles: &mut [(&'a dyn SelectHandle, usize, *const u8)]) -> SelectedOperation<'a> { if handles.is_empty() { panic!("no operations have been added to `Select`"); } @@ -472,7 +472,7 @@ pub fn select<'a>(handles: &mut [(&'a SelectHandle, usize, *const u8)]) -> Selec /// Blocks for a limited time until one of the operations becomes ready and selects it. #[inline] pub fn select_timeout<'a>( - handles: &mut [(&'a SelectHandle, usize, *const u8)], + handles: &mut [(&'a dyn SelectHandle, usize, *const u8)], timeout: Duration, ) -> Result, SelectTimeoutError> { let timeout = Timeout::At(Instant::now() + timeout); @@ -573,7 +573,7 @@ pub fn select_timeout<'a>( /// [`ready_timeout`]: struct.Select.html#method.ready_timeout pub struct Select<'a> { /// A list of senders and receivers participating in selection. - handles: Vec<(&'a SelectHandle, usize, *const u8)>, + handles: Vec<(&'a dyn SelectHandle, usize, *const u8)>, /// The next index to assign to an operation. next_index: usize, diff --git a/crossbeam-channel/tests/array.rs b/crossbeam-channel/tests/array.rs index bc97f8b88..a6fc8451b 100644 --- a/crossbeam-channel/tests/array.rs +++ b/crossbeam-channel/tests/array.rs @@ -624,7 +624,7 @@ fn recv_in_send() { fn channel_through_channel() { const COUNT: usize = 1000; - type T = Box; + type T = Box; let (s, r) = bounded::(1); diff --git a/crossbeam-channel/tests/golang.rs b/crossbeam-channel/tests/golang.rs index 8f48db62e..be015b28f 100644 --- a/crossbeam-channel/tests/golang.rs +++ b/crossbeam-channel/tests/golang.rs @@ -1289,7 +1289,7 @@ mod chan_test { fn test_chan_send_interface() { struct Mt; - let c = make::>(1); + let c = make::>(1); c.send(Box::new(Mt)); select! { diff --git a/crossbeam-channel/tests/list.rs b/crossbeam-channel/tests/list.rs index 2bf4c16ce..ed1d4c420 100644 --- a/crossbeam-channel/tests/list.rs +++ b/crossbeam-channel/tests/list.rs @@ -503,7 +503,7 @@ fn recv_in_send() { fn channel_through_channel() { const COUNT: usize = 1000; - type T = Box; + type T = Box; let (s, r) = unbounded::(); diff --git a/crossbeam-channel/tests/ready.rs b/crossbeam-channel/tests/ready.rs index f5efd0806..23769b7bd 100644 --- a/crossbeam-channel/tests/ready.rs +++ b/crossbeam-channel/tests/ready.rs @@ -673,7 +673,7 @@ fn send_recv_same_channel() { fn channel_through_channel() { const COUNT: usize = 1000; - type T = Box; + type T = Box; for cap in 1..4 { let (s, r) = bounded::(cap); diff --git a/crossbeam-channel/tests/select.rs b/crossbeam-channel/tests/select.rs index 7c62a4c34..b18d66d7c 100644 --- a/crossbeam-channel/tests/select.rs +++ b/crossbeam-channel/tests/select.rs @@ -947,7 +947,7 @@ fn matching_with_leftover() { fn channel_through_channel() { const COUNT: usize = 1000; - type T = Box; + type T = Box; for cap in 0..3 { let (s, r) = bounded::(cap); diff --git a/crossbeam-channel/tests/select_macro.rs b/crossbeam-channel/tests/select_macro.rs index 0a7eddba8..a9cc7fac7 100644 --- a/crossbeam-channel/tests/select_macro.rs +++ b/crossbeam-channel/tests/select_macro.rs @@ -687,7 +687,7 @@ fn matching_with_leftover() { fn channel_through_channel() { const COUNT: usize = 1000; - type T = Box; + type T = Box; for cap in 0..3 { let (s, r) = bounded::(cap); diff --git a/crossbeam-channel/tests/zero.rs b/crossbeam-channel/tests/zero.rs index b38227d8d..bd336ee15 100644 --- a/crossbeam-channel/tests/zero.rs +++ b/crossbeam-channel/tests/zero.rs @@ -524,7 +524,7 @@ fn recv_in_send() { fn channel_through_channel() { const COUNT: usize = 1000; - type T = Box; + type T = Box; let (s, r) = bounded::(0); diff --git a/crossbeam-utils/src/thread.rs b/crossbeam-utils/src/thread.rs index 2613fb785..a88c0f101 100644 --- a/crossbeam-utils/src/thread.rs +++ b/crossbeam-utils/src/thread.rs @@ -423,8 +423,8 @@ impl<'scope, 'env> ScopedThreadBuilder<'scope, 'env> { let closure = move || closure.take().unwrap()(); // Allocate `clsoure` on the heap and erase the `'env` bound. - let closure: Box = Box::new(closure); - let closure: Box = unsafe { mem::transmute(closure) }; + let closure: Box = Box::new(closure); + let closure: Box = unsafe { mem::transmute(closure) }; // Finally, spawn the closure. let mut closure = closure; diff --git a/crossbeam-utils/tests/thread.rs b/crossbeam-utils/tests/thread.rs index b691745e0..e55d90fb1 100644 --- a/crossbeam-utils/tests/thread.rs +++ b/crossbeam-utils/tests/thread.rs @@ -99,7 +99,7 @@ fn panic_twice() { let err = result.unwrap_err(); let vec = err - .downcast_ref::>>() + .downcast_ref::>>() .unwrap(); assert_eq!(2, vec.len()); @@ -119,7 +119,7 @@ fn panic_many() { let err = result.unwrap_err(); let vec = err - .downcast_ref::>>() + .downcast_ref::>>() .unwrap(); assert_eq!(3, vec.len()); From 7c77adad3e7db38d11a4859cc6ff3544cc26a1c2 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 16 Oct 2019 21:30:24 +0900 Subject: [PATCH 6/7] Allow deprecated mem::uninitialized --- crossbeam-epoch/src/deferred.rs | 6 ++++++ crossbeam-epoch/src/sync/queue.rs | 3 +++ 2 files changed, 9 insertions(+) diff --git a/crossbeam-epoch/src/deferred.rs b/crossbeam-epoch/src/deferred.rs index 574b954ac..3d22ee633 100644 --- a/crossbeam-epoch/src/deferred.rs +++ b/crossbeam-epoch/src/deferred.rs @@ -36,6 +36,9 @@ impl Deferred { unsafe { if size <= mem::size_of::() && align <= mem::align_of::() { + // TODO(taiki-e): when the minimum supported Rust version is bumped to 1.36+, + // replace this with `mem::MaybeUninit`. + #[allow(deprecated)] let mut data: Data = mem::uninitialized(); ptr::write(&mut data as *mut Data as *mut F, f); @@ -51,6 +54,9 @@ impl Deferred { } } else { let b: Box = Box::new(f); + // TODO(taiki-e): when the minimum supported Rust version is bumped to 1.36+, + // replace this with `mem::MaybeUninit`. + #[allow(deprecated)] let mut data: Data = mem::uninitialized(); ptr::write(&mut data as *mut Data as *mut Box, b); diff --git a/crossbeam-epoch/src/sync/queue.rs b/crossbeam-epoch/src/sync/queue.rs index 671d046ce..6fe0bef37 100644 --- a/crossbeam-epoch/src/sync/queue.rs +++ b/crossbeam-epoch/src/sync/queue.rs @@ -46,6 +46,9 @@ impl Queue { head: CachePadded::new(Atomic::null()), tail: CachePadded::new(Atomic::null()), }; + // TODO(taiki-e): when the minimum supported Rust version is bumped to 1.36+, + // replace this with `mem::MaybeUninit`. + #[allow(deprecated)] let sentinel = Owned::new(Node { data: unsafe { mem::uninitialized() }, next: Atomic::null(), From 35dc8248a1b86238d479166f77981db1916ff8d4 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 16 Oct 2019 22:27:02 +0900 Subject: [PATCH 7/7] Format with rustfmt --- crossbeam-channel/src/select.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crossbeam-channel/src/select.rs b/crossbeam-channel/src/select.rs index b5adf29d2..60c6a45dc 100644 --- a/crossbeam-channel/src/select.rs +++ b/crossbeam-channel/src/select.rs @@ -279,7 +279,8 @@ fn run_select( // Find the selected operation. for (handle, i, ptr) in handles.iter_mut() { // Is this the selected operation? - if sel == Selected::Operation(Operation::hook::<&dyn SelectHandle>(handle)) { + if sel == Selected::Operation(Operation::hook::<&dyn SelectHandle>(handle)) + { // Try selecting this operation. if handle.accept(&mut token, cx) { return Some((*i, *ptr)); @@ -317,7 +318,10 @@ fn run_select( } /// Runs until one of the operations becomes ready, potentially blocking the current thread. -fn run_ready(handles: &mut [(&dyn SelectHandle, usize, *const u8)], timeout: Timeout) -> Option { +fn run_ready( + handles: &mut [(&dyn SelectHandle, usize, *const u8)], + timeout: Timeout, +) -> Option { if handles.is_empty() { // Wait until the timeout and return. match timeout { @@ -455,7 +459,9 @@ pub fn try_select<'a>( /// Blocks until one of the operations becomes ready and selects it. #[inline] -pub fn select<'a>(handles: &mut [(&'a dyn SelectHandle, usize, *const u8)]) -> SelectedOperation<'a> { +pub fn select<'a>( + handles: &mut [(&'a dyn SelectHandle, usize, *const u8)], +) -> SelectedOperation<'a> { if handles.is_empty() { panic!("no operations have been added to `Select`"); }