Skip to content

Commit cdc4379

Browse files
bors[bot]taiki-e
andauthored
Merge #428
428: Fix build failure on nightly and the minimum version r=jeehoonkang a=taiki-e `target_has_atomic = "cas"` was removed in rust-lang/rust#65214. Fixes rust-lang/rust#65424 Fixes #412 Co-authored-by: Taiki Endo <[email protected]>
2 parents ae148de + 7c77ada commit cdc4379

29 files changed

+72
-81
lines changed

.travis.yml

+16-8
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ matrix:
1616
- rust: 1.28.0
1717
name: "crossbeam on 1.28.0"
1818
script: ./ci/crossbeam.sh
19-
- rust: 1.26.0
20-
name: "crossbeam-channel on 1.26.0"
19+
- rust: 1.28.0
20+
name: "crossbeam-channel on 1.28.0"
2121
script: ./ci/crossbeam-channel.sh
2222
- rust: 1.28.0
2323
name: "crossbeam-deque on 1.28.0"
2424
script: ./ci/crossbeam-deque.sh
25-
- rust: 1.26.0
26-
name: "crossbeam-epoch on 1.26.0"
25+
- rust: 1.28.0
26+
name: "crossbeam-epoch on 1.28.0"
2727
script: ./ci/crossbeam-epoch.sh
28-
- rust: 1.26.0
29-
name: "crossbeam-queue on 1.26.0"
28+
- rust: 1.28.0
29+
name: "crossbeam-queue on 1.28.0"
3030
script: ./ci/crossbeam-queue.sh
3131
- rust: 1.28.0
3232
name: "crossbeam-skiplist on 1.28.0"
3333
script: ./ci/crossbeam-skiplist.sh
34-
- rust: 1.26.0
35-
name: "crossbeam-utils on 1.26.0"
34+
- rust: 1.28.0
35+
name: "crossbeam-utils on 1.28.0"
3636
script: ./ci/crossbeam-utils.sh
3737

3838
# Test crates on nightly Rust.
@@ -90,3 +90,11 @@ matrix:
9090
- rust: stable
9191
name: "rustfmt"
9292
script: ./ci/rustfmt.sh
93+
94+
before_script:
95+
# cfg-if 0.1.10 requires Rust 1.31+ so downgrade it.
96+
- |
97+
if [[ "$TRAVIS_RUST_VERSION" == "1.28.0" ]]; then
98+
cargo generate-lockfile
99+
cargo update -p cfg-if --precise 0.1.9
100+
fi

ci/crossbeam-channel.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
cd "$(dirname "$0")"/../crossbeam-channel
44
set -ex
55

6-
if [[ "$TRAVIS_RUST_VERSION" != "nightly" ]]; then
7-
export RUSTFLAGS="-D warnings"
8-
fi
6+
export RUSTFLAGS="-D warnings"
97

108
cargo check --bins --examples --tests
119
cargo test -- --test-threads=1

ci/crossbeam-deque.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
cd "$(dirname "$0")"/../crossbeam-deque
44
set -ex
55

6-
if [[ "$TRAVIS_RUST_VERSION" != "nightly" ]]; then
7-
export RUSTFLAGS="-D warnings"
8-
fi
6+
export RUSTFLAGS="-D warnings"
97

108
cargo check --bins --examples --tests
119
cargo test

ci/crossbeam-epoch.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
cd "$(dirname "$0")"/../crossbeam-epoch
44
set -ex
55

6-
if [[ "$TRAVIS_RUST_VERSION" != "nightly" ]]; then
7-
export RUSTFLAGS="-D warnings"
8-
fi
6+
export RUSTFLAGS="-D warnings"
97

108
cargo check --no-default-features
119
cargo check --bins --examples --tests

ci/crossbeam-queue.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
cd "$(dirname "$0")"/../crossbeam-queue
44
set -ex
55

6-
if [[ "$TRAVIS_RUST_VERSION" != "nightly" ]]; then
7-
export RUSTFLAGS="-D warnings"
8-
fi
6+
export RUSTFLAGS="-D warnings"
97

108
cargo check --bins --examples --tests
119
cargo test

ci/crossbeam-skiplist.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
cd "$(dirname "$0")"/../crossbeam-skiplist
44
set -ex
55

6-
if [[ "$TRAVIS_RUST_VERSION" != "nightly" ]]; then
7-
export RUSTFLAGS="-D warnings"
8-
fi
6+
export RUSTFLAGS="-D warnings"
97

108
cargo check --no-default-features
119
cargo check --bins --examples --tests

ci/crossbeam-utils.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
cd "$(dirname "$0")"/../crossbeam-utils
44
set -ex
55

6-
if [[ "$TRAVIS_RUST_VERSION" != "nightly" ]]; then
7-
export RUSTFLAGS="-D warnings"
8-
fi
6+
export RUSTFLAGS="-D warnings"
97

108
cargo check --no-default-features
119
cargo check --bins --examples --tests

ci/crossbeam.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
cd "$(dirname "$0")"/..
44
set -ex
55

6-
if [[ "$TRAVIS_RUST_VERSION" != "nightly" ]]; then
7-
export RUSTFLAGS="-D warnings"
8-
fi
6+
export RUSTFLAGS="-D warnings"
97

108
cargo check --no-default-features
119
cargo check --bins --examples --tests

crossbeam-channel/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ https://github.com/crossbeam-rs/crossbeam-channel)
88
https://crates.io/crates/crossbeam-channel)
99
[![Documentation](https://docs.rs/crossbeam-channel/badge.svg)](
1010
https://docs.rs/crossbeam-channel)
11-
[![Rust 1.26+](https://img.shields.io/badge/rust-1.26+-lightgray.svg)](
11+
[![Rust 1.28+](https://img.shields.io/badge/rust-1.28+-lightgray.svg)](
1212
https://www.rust-lang.org)
1313
[![chat](https://img.shields.io/discord/569610676205781012.svg?logo=discord)](https://discord.gg/BBYwKq)
1414

crossbeam-channel/src/err.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl<T: Send> error::Error for SendError<T> {
132132
"sending on a disconnected channel"
133133
}
134134

135-
fn cause(&self) -> Option<&error::Error> {
135+
fn cause(&self) -> Option<&dyn error::Error> {
136136
None
137137
}
138138
}
@@ -183,7 +183,7 @@ impl<T: Send> error::Error for TrySendError<T> {
183183
}
184184
}
185185

186-
fn cause(&self) -> Option<&error::Error> {
186+
fn cause(&self) -> Option<&dyn error::Error> {
187187
None
188188
}
189189
}
@@ -254,7 +254,7 @@ impl<T: Send> error::Error for SendTimeoutError<T> {
254254
"sending on an empty and disconnected channel"
255255
}
256256

257-
fn cause(&self) -> Option<&error::Error> {
257+
fn cause(&self) -> Option<&dyn error::Error> {
258258
None
259259
}
260260
}
@@ -317,7 +317,7 @@ impl error::Error for RecvError {
317317
"receiving on an empty and disconnected channel"
318318
}
319319

320-
fn cause(&self) -> Option<&error::Error> {
320+
fn cause(&self) -> Option<&dyn error::Error> {
321321
None
322322
}
323323
}
@@ -339,7 +339,7 @@ impl error::Error for TryRecvError {
339339
}
340340
}
341341

342-
fn cause(&self) -> Option<&error::Error> {
342+
fn cause(&self) -> Option<&dyn error::Error> {
343343
None
344344
}
345345
}
@@ -387,7 +387,7 @@ impl error::Error for RecvTimeoutError {
387387
}
388388
}
389389

390-
fn cause(&self) -> Option<&error::Error> {
390+
fn cause(&self) -> Option<&dyn error::Error> {
391391
None
392392
}
393393
}
@@ -429,7 +429,7 @@ impl error::Error for TrySelectError {
429429
"all operations in select would block"
430430
}
431431

432-
fn cause(&self) -> Option<&error::Error> {
432+
fn cause(&self) -> Option<&dyn error::Error> {
433433
None
434434
}
435435
}
@@ -445,7 +445,7 @@ impl error::Error for SelectTimeoutError {
445445
"timed out waiting on select"
446446
}
447447

448-
fn cause(&self) -> Option<&error::Error> {
448+
fn cause(&self) -> Option<&dyn error::Error> {
449449
None
450450
}
451451
}

crossbeam-channel/src/select.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ enum Timeout {
171171
/// Successful receive operations will have to be followed up by `channel::read()` and successful
172172
/// send operations by `channel::write()`.
173173
fn run_select(
174-
handles: &mut [(&SelectHandle, usize, *const u8)],
174+
handles: &mut [(&dyn SelectHandle, usize, *const u8)],
175175
timeout: Timeout,
176176
) -> Option<(Token, usize, *const u8)> {
177177
if handles.is_empty() {
@@ -220,7 +220,7 @@ fn run_select(
220220
registered_count += 1;
221221

222222
// If registration returns `false`, that means the operation has just become ready.
223-
if handle.register(Operation::hook::<&SelectHandle>(handle), cx) {
223+
if handle.register(Operation::hook::<&dyn SelectHandle>(handle), cx) {
224224
// Try aborting select.
225225
sel = match cx.try_select(Selected::Aborted) {
226226
Ok(()) => {
@@ -259,7 +259,7 @@ fn run_select(
259259

260260
// Unregister all registered operations.
261261
for (handle, _, _) in handles.iter_mut().take(registered_count) {
262-
handle.unregister(Operation::hook::<&SelectHandle>(handle));
262+
handle.unregister(Operation::hook::<&dyn SelectHandle>(handle));
263263
}
264264

265265
match sel {
@@ -279,7 +279,7 @@ fn run_select(
279279
// Find the selected operation.
280280
for (handle, i, ptr) in handles.iter_mut() {
281281
// Is this the selected operation?
282-
if sel == Selected::Operation(Operation::hook::<&SelectHandle>(handle)) {
282+
if sel == Selected::Operation(Operation::hook::<&dyn SelectHandle>(handle)) {
283283
// Try selecting this operation.
284284
if handle.accept(&mut token, cx) {
285285
return Some((*i, *ptr));
@@ -317,7 +317,7 @@ fn run_select(
317317
}
318318

319319
/// Runs until one of the operations becomes ready, potentially blocking the current thread.
320-
fn run_ready(handles: &mut [(&SelectHandle, usize, *const u8)], timeout: Timeout) -> Option<usize> {
320+
fn run_ready(handles: &mut [(&dyn SelectHandle, usize, *const u8)], timeout: Timeout) -> Option<usize> {
321321
if handles.is_empty() {
322322
// Wait until the timeout and return.
323323
match timeout {
@@ -372,7 +372,7 @@ fn run_ready(handles: &mut [(&SelectHandle, usize, *const u8)], timeout: Timeout
372372
// Begin watching all operations.
373373
for (handle, _, _) in handles.iter_mut() {
374374
registered_count += 1;
375-
let oper = Operation::hook::<&SelectHandle>(handle);
375+
let oper = Operation::hook::<&dyn SelectHandle>(handle);
376376

377377
// If registration returns `false`, that means the operation has just become ready.
378378
if handle.watch(oper, cx) {
@@ -410,7 +410,7 @@ fn run_ready(handles: &mut [(&SelectHandle, usize, *const u8)], timeout: Timeout
410410

411411
// Unwatch all operations.
412412
for (handle, _, _) in handles.iter_mut().take(registered_count) {
413-
handle.unwatch(Operation::hook::<&SelectHandle>(handle));
413+
handle.unwatch(Operation::hook::<&dyn SelectHandle>(handle));
414414
}
415415

416416
match sel {
@@ -419,7 +419,7 @@ fn run_ready(handles: &mut [(&SelectHandle, usize, *const u8)], timeout: Timeout
419419
Selected::Disconnected => {}
420420
Selected::Operation(_) => {
421421
for (handle, i, _) in handles.iter_mut() {
422-
let oper = Operation::hook::<&SelectHandle>(handle);
422+
let oper = Operation::hook::<&dyn SelectHandle>(handle);
423423
if sel == Selected::Operation(oper) {
424424
return Some(*i);
425425
}
@@ -440,7 +440,7 @@ fn run_ready(handles: &mut [(&SelectHandle, usize, *const u8)], timeout: Timeout
440440
/// Attempts to select one of the operations without blocking.
441441
#[inline]
442442
pub fn try_select<'a>(
443-
handles: &mut [(&'a SelectHandle, usize, *const u8)],
443+
handles: &mut [(&'a dyn SelectHandle, usize, *const u8)],
444444
) -> Result<SelectedOperation<'a>, TrySelectError> {
445445
match run_select(handles, Timeout::Now) {
446446
None => Err(TrySelectError),
@@ -455,7 +455,7 @@ pub fn try_select<'a>(
455455

456456
/// Blocks until one of the operations becomes ready and selects it.
457457
#[inline]
458-
pub fn select<'a>(handles: &mut [(&'a SelectHandle, usize, *const u8)]) -> SelectedOperation<'a> {
458+
pub fn select<'a>(handles: &mut [(&'a dyn SelectHandle, usize, *const u8)]) -> SelectedOperation<'a> {
459459
if handles.is_empty() {
460460
panic!("no operations have been added to `Select`");
461461
}
@@ -472,7 +472,7 @@ pub fn select<'a>(handles: &mut [(&'a SelectHandle, usize, *const u8)]) -> Selec
472472
/// Blocks for a limited time until one of the operations becomes ready and selects it.
473473
#[inline]
474474
pub fn select_timeout<'a>(
475-
handles: &mut [(&'a SelectHandle, usize, *const u8)],
475+
handles: &mut [(&'a dyn SelectHandle, usize, *const u8)],
476476
timeout: Duration,
477477
) -> Result<SelectedOperation<'a>, SelectTimeoutError> {
478478
let timeout = Timeout::At(Instant::now() + timeout);
@@ -573,7 +573,7 @@ pub fn select_timeout<'a>(
573573
/// [`ready_timeout`]: struct.Select.html#method.ready_timeout
574574
pub struct Select<'a> {
575575
/// A list of senders and receivers participating in selection.
576-
handles: Vec<(&'a SelectHandle, usize, *const u8)>,
576+
handles: Vec<(&'a dyn SelectHandle, usize, *const u8)>,
577577

578578
/// The next index to assign to an operation.
579579
next_index: usize,

crossbeam-channel/tests/array.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ fn recv_in_send() {
624624
fn channel_through_channel() {
625625
const COUNT: usize = 1000;
626626

627-
type T = Box<Any + Send>;
627+
type T = Box<dyn Any + Send>;
628628

629629
let (s, r) = bounded::<T>(1);
630630

crossbeam-channel/tests/golang.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ mod chan_test {
12891289
fn test_chan_send_interface() {
12901290
struct Mt;
12911291

1292-
let c = make::<Box<Any>>(1);
1292+
let c = make::<Box<dyn Any>>(1);
12931293
c.send(Box::new(Mt));
12941294

12951295
select! {

crossbeam-channel/tests/list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ fn recv_in_send() {
503503
fn channel_through_channel() {
504504
const COUNT: usize = 1000;
505505

506-
type T = Box<Any + Send>;
506+
type T = Box<dyn Any + Send>;
507507

508508
let (s, r) = unbounded::<T>();
509509

crossbeam-channel/tests/ready.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ fn send_recv_same_channel() {
673673
fn channel_through_channel() {
674674
const COUNT: usize = 1000;
675675

676-
type T = Box<Any + Send>;
676+
type T = Box<dyn Any + Send>;
677677

678678
for cap in 1..4 {
679679
let (s, r) = bounded::<T>(cap);

crossbeam-channel/tests/select.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ fn matching_with_leftover() {
947947
fn channel_through_channel() {
948948
const COUNT: usize = 1000;
949949

950-
type T = Box<Any + Send>;
950+
type T = Box<dyn Any + Send>;
951951

952952
for cap in 0..3 {
953953
let (s, r) = bounded::<T>(cap);

crossbeam-channel/tests/select_macro.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ fn matching_with_leftover() {
687687
fn channel_through_channel() {
688688
const COUNT: usize = 1000;
689689

690-
type T = Box<Any + Send>;
690+
type T = Box<dyn Any + Send>;
691691

692692
for cap in 0..3 {
693693
let (s, r) = bounded::<T>(cap);

crossbeam-channel/tests/zero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ fn recv_in_send() {
524524
fn channel_through_channel() {
525525
const COUNT: usize = 1000;
526526

527-
type T = Box<Any + Send>;
527+
type T = Box<dyn Any + Send>;
528528

529529
let (s, r) = bounded::<T>(0);
530530

crossbeam-epoch/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ https://github.com/crossbeam-rs/crossbeam-epoch)
88
https://crates.io/crates/crossbeam-epoch)
99
[![Documentation](https://docs.rs/crossbeam-epoch/badge.svg)](
1010
https://docs.rs/crossbeam-epoch)
11-
[![Rust 1.26+](https://img.shields.io/badge/rust-1.26+-lightgray.svg)](
11+
[![Rust 1.28+](https://img.shields.io/badge/rust-1.28+-lightgray.svg)](
1212
https://www.rust-lang.org)
1313
[![chat](https://img.shields.io/discord/569610676205781012.svg?logo=discord)](https://discord.gg/BBYwKq)
1414

0 commit comments

Comments
 (0)