Skip to content

Commit 352ff3b

Browse files
bors[bot]taiki-e
andauthored
Merge #914
914: 0.8: Prepare for the next release r=taiki-e a=taiki-e Backports #913 and CI-related patches. Changes: - crossbeam-epoch 0.8.11 -> 0.8.12 - Removes the dependency on the `once_cell` crate to restore the MSRV. (#913) - Work around [rust-lang#98302](rust-lang/rust#98302), which causes compile error on windows-gnu when LTO is enabled. (#913) - crossbeam-utils 0.8.11 -> 0.8.12 - Removes the dependency on the `once_cell` crate to restore the MSRV. (#913) - Work around [rust-lang#98302](rust-lang/rust#98302), which causes compile error on windows-gnu when LTO is enabled. (#913) Co-authored-by: Taiki Endo <[email protected]>
2 parents 1ea6c55 + f3404eb commit 352ff3b

File tree

25 files changed

+203
-84
lines changed

25 files changed

+203
-84
lines changed

.clippy.toml

-1
This file was deleted.

.github/workflows/ci.yml

+27-29
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ jobs:
5858
runs-on: ${{ matrix.os }}
5959
steps:
6060
- uses: actions/checkout@v3
61-
- name: Install Rust
62-
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
63-
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
61+
- uses: dtolnay/rust-toolchain@v1
62+
with:
63+
toolchain: ${{ matrix.rust }}
6464
- name: Install cross
6565
uses: taiki-e/install-action@cross
6666
if: matrix.target != ''
@@ -80,8 +80,9 @@ jobs:
8080
runs-on: ubuntu-latest
8181
steps:
8282
- uses: actions/checkout@v3
83-
- name: Install Rust
84-
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
83+
- uses: dtolnay/rust-toolchain@v1
84+
with:
85+
toolchain: ${{ matrix.rust }}
8586
- name: Install cargo-hack
8687
uses: taiki-e/install-action@cargo-hack
8788
- name: Check features
@@ -92,10 +93,11 @@ jobs:
9293
runs-on: ubuntu-latest
9394
steps:
9495
- uses: actions/checkout@v3
95-
- name: Install Rust
96-
run: rustup update nightly && rustup default nightly
96+
- uses: dtolnay/rust-toolchain@nightly
9797
- name: Install cargo-hack
9898
uses: taiki-e/install-action@cargo-hack
99+
- name: Install cargo-minimal-versions
100+
uses: taiki-e/install-action@cargo-minimal-versions
99101
- name: dependency tree check
100102
run: ./ci/dependencies.sh
101103

@@ -107,8 +109,7 @@ jobs:
107109
pull-requests: write
108110
steps:
109111
- uses: actions/checkout@v3
110-
- name: Install Rust
111-
run: rustup update nightly && rustup default nightly
112+
- uses: dtolnay/rust-toolchain@nightly
112113
- run: ci/no_atomic.sh
113114
- run: git add -N . && git diff --exit-code
114115
if: github.repository_owner != 'crossbeam-rs' || github.event_name != 'schedule'
@@ -140,28 +141,27 @@ jobs:
140141
runs-on: ubuntu-latest
141142
steps:
142143
- uses: actions/checkout@v3
143-
- name: Install Rust
144-
run: rustup update stable
144+
- uses: dtolnay/rust-toolchain@stable
145145
- name: rustfmt
146146
run: ./ci/rustfmt.sh
147147

148-
# Check clippy.
149-
clippy:
150-
runs-on: ubuntu-latest
151-
steps:
152-
- uses: actions/checkout@v3
153-
- name: Install Rust
154-
run: rustup update stable
155-
- name: clippy
156-
run: ./ci/clippy.sh
148+
# This branch no longer actively developed. Most commits to this
149+
# branch are backporting and should not be blocked by clippy.
150+
# # Check clippy.
151+
# clippy:
152+
# runs-on: ubuntu-latest
153+
# steps:
154+
# - uses: actions/checkout@v3
155+
# - uses: dtolnay/rust-toolchain@stable
156+
# - name: clippy
157+
# run: ./ci/clippy.sh
157158

158159
# Run miri.
159160
miri:
160161
runs-on: ubuntu-latest
161162
steps:
162163
- uses: actions/checkout@v3
163-
- name: Install Rust
164-
run: rustup toolchain install nightly --component miri && rustup default nightly
164+
- uses: dtolnay/rust-toolchain@miri
165165
- name: miri
166166
run: ./ci/miri.sh
167167

@@ -170,8 +170,7 @@ jobs:
170170
runs-on: ubuntu-latest
171171
steps:
172172
- uses: actions/checkout@v3
173-
- name: Install Rust
174-
run: rustup update nightly && rustup default nightly
173+
- uses: dtolnay/rust-toolchain@nightly
175174
- name: Run sanitizers
176175
run: ./ci/san.sh
177176

@@ -180,8 +179,7 @@ jobs:
180179
runs-on: ubuntu-latest
181180
steps:
182181
- uses: actions/checkout@v3
183-
- name: Install Rust
184-
run: rustup update stable
182+
- uses: dtolnay/rust-toolchain@stable
185183
- name: loom
186184
run: ./ci/crossbeam-epoch-loom.sh
187185

@@ -190,8 +188,7 @@ jobs:
190188
runs-on: ubuntu-latest
191189
steps:
192190
- uses: actions/checkout@v3
193-
- name: Install Rust
194-
run: rustup update nightly && rustup default nightly
191+
- uses: dtolnay/rust-toolchain@nightly
195192
- name: docs
196193
run: ./ci/docs.sh
197194

@@ -218,11 +215,12 @@ jobs:
218215
- dependencies
219216
- codegen
220217
- rustfmt
221-
- clippy
218+
# - clippy
222219
- miri
223220
- san
224221
- loom
225222
- docs
223+
- shellcheck
226224
runs-on: ubuntu-latest
227225
steps:
228226
- name: Mark the job as a success

.github/workflows/release.yml

-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ on:
99
- crossbeam-[0-9]+.*
1010
- crossbeam-[a-z]+-[0-9]+.*
1111

12-
env:
13-
RUSTFLAGS: -Dwarnings
14-
RUST_BACKTRACE: 1
15-
1612
defaults:
1713
run:
1814
shell: bash

ci/dependencies.sh

+1-7
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,4 @@ cargo tree
77
cargo tree --duplicate
88

99
# Check minimal versions.
10-
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`
11-
# from determining minimal versions based on dev-dependencies.
12-
cargo hack --remove-dev-deps --workspace
13-
# Update Cargo.lock to minimal version dependencies.
14-
cargo update -Zminimal-versions
15-
cargo tree
16-
cargo hack check --all --all-features --exclude benchmarks
10+
cargo minimal-versions build --workspace --all-features --exclude benchmarks

ci/rustfmt.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ cd "$(dirname "$0")"/..
55

66
rustup component add rustfmt
77

8-
cargo fmt --all -- --check
8+
cargo fmt --all --check

crossbeam-channel/src/channel.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub fn bounded<T>(cap: usize) -> (Sender<T>, Receiver<T>) {
160160
/// let ms = |ms| Duration::from_millis(ms);
161161
///
162162
/// // Returns `true` if `a` and `b` are very close `Instant`s.
163-
/// let eq = |a, b| a + ms(50) > b && b + ms(50) > a;
163+
/// let eq = |a, b| a + ms(60) > b && b + ms(60) > a;
164164
///
165165
/// let start = Instant::now();
166166
/// let r = after(ms(100));

crossbeam-channel/tests/golang.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//! - https://golang.org/LICENSE
1010
//! - https://golang.org/PATENTS
1111
12-
#![allow(clippy::mutex_atomic, clippy::redundant_clone)]
12+
#![allow(clippy::redundant_clone)]
1313

1414
use std::alloc::{GlobalAlloc, Layout, System};
1515
use std::any::Any;

crossbeam-channel/tests/ready.rs

+1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ fn default_when_disconnected() {
229229
}
230230

231231
#[test]
232+
#[cfg_attr(miri, ignore)] // this test makes timing assumptions, but Miri is so slow it violates them
232233
fn default_only() {
233234
let start = Instant::now();
234235

crossbeam-deque/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
rust_2018_idioms,
9696
unreachable_pub
9797
)]
98-
#![allow(clippy::question_mark)] // https://github.com/rust-lang/rust-clippy/issues/8281
9998
#![cfg_attr(not(feature = "std"), no_std)]
10099

101100
use cfg_if::cfg_if;

crossbeam-epoch/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Version 0.9.11
2+
3+
- Removes the dependency on the `once_cell` crate to restore the MSRV. (#913)
4+
- Work around [rust-lang#98302](https://github.com/rust-lang/rust/issues/98302), which causes compile error on windows-gnu when LTO is enabled. (#913)
5+
16
# Version 0.9.10
27

38
- Bump the minimum supported Rust version to 1.38. (#877)

crossbeam-epoch/Cargo.toml

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name = "crossbeam-epoch"
44
# - Update CHANGELOG.md
55
# - Update README.md
66
# - Create "crossbeam-epoch-X.Y.Z" git tag
7-
version = "0.9.10"
7+
version = "0.9.11"
88
edition = "2018"
99
rust-version = "1.38"
1010
license = "MIT OR Apache-2.0"
@@ -19,7 +19,7 @@ default = ["std"]
1919

2020
# Enable to use APIs that require `std`.
2121
# This is enabled by default.
22-
std = ["alloc", "crossbeam-utils/std", "once_cell"]
22+
std = ["alloc", "crossbeam-utils/std"]
2323

2424
# Enable to use APIs that require `alloc`.
2525
# This is enabled by default and also enabled if the `std` feature is enabled.
@@ -48,7 +48,6 @@ autocfg = "1"
4848
[dependencies]
4949
cfg-if = "1"
5050
memoffset = "0.6"
51-
once_cell = { version = "1", optional = true }
5251
scopeguard = { version = "1.1", default-features = false }
5352

5453
# Enable the use of loom for concurrency testing.

crossbeam-epoch/src/default.rs

+21-13
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,30 @@ use crate::collector::{Collector, LocalHandle};
88
use crate::guard::Guard;
99
use crate::primitive::thread_local;
1010
#[cfg(not(crossbeam_loom))]
11-
use once_cell::sync::Lazy;
11+
use crate::sync::once_lock::OnceLock;
1212

13-
/// The global data for the default garbage collector.
14-
#[cfg(not(crossbeam_loom))]
15-
static COLLECTOR: Lazy<Collector> = Lazy::new(Collector::new);
16-
// FIXME: loom does not currently provide the equivalent of Lazy:
17-
// https://github.com/tokio-rs/loom/issues/263
18-
#[cfg(crossbeam_loom)]
19-
loom::lazy_static! {
20-
/// The global data for the default garbage collector.
21-
static ref COLLECTOR: Collector = Collector::new();
13+
fn collector() -> &'static Collector {
14+
#[cfg(not(crossbeam_loom))]
15+
{
16+
/// The global data for the default garbage collector.
17+
static COLLECTOR: OnceLock<Collector> = OnceLock::new();
18+
COLLECTOR.get_or_init(Collector::new)
19+
}
20+
// FIXME: loom does not currently provide the equivalent of Lazy:
21+
// https://github.com/tokio-rs/loom/issues/263
22+
#[cfg(crossbeam_loom)]
23+
{
24+
loom::lazy_static! {
25+
/// The global data for the default garbage collector.
26+
static ref COLLECTOR: Collector = Collector::new();
27+
}
28+
&COLLECTOR
29+
}
2230
}
2331

2432
thread_local! {
2533
/// The per-thread participant for the default garbage collector.
26-
static HANDLE: LocalHandle = COLLECTOR.register();
34+
static HANDLE: LocalHandle = collector().register();
2735
}
2836

2937
/// Pins the current thread.
@@ -40,7 +48,7 @@ pub fn is_pinned() -> bool {
4048

4149
/// Returns the default global collector.
4250
pub fn default_collector() -> &'static Collector {
43-
&COLLECTOR
51+
collector()
4452
}
4553

4654
#[inline]
@@ -50,7 +58,7 @@ where
5058
{
5159
HANDLE
5260
.try_with(|h| f(h))
53-
.unwrap_or_else(|_| f(&COLLECTOR.register()))
61+
.unwrap_or_else(|_| f(&collector().register()))
5462
}
5563

5664
#[cfg(all(test, not(crossbeam_loom)))]

crossbeam-epoch/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ mod primitive {
107107
// https://github.com/tokio-rs/loom#handling-loom-api-differences
108108
impl<T> UnsafeCell<T> {
109109
#[inline]
110-
pub(crate) fn new(data: T) -> UnsafeCell<T> {
110+
pub(crate) const fn new(data: T) -> UnsafeCell<T> {
111111
UnsafeCell(::core::cell::UnsafeCell::new(data))
112112
}
113113

crossbeam-epoch/src/sync/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
//! Synchronization primitives.
22
33
pub(crate) mod list;
4+
#[cfg(feature = "std")]
5+
#[cfg(not(crossbeam_loom))]
6+
pub(crate) mod once_lock;
47
pub(crate) mod queue;

crossbeam-epoch/src/sync/once_lock.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../crossbeam-utils/src/sync/once_lock.rs

crossbeam-skiplist/tests/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(clippy::mutex_atomic, clippy::redundant_clone)]
1+
#![allow(clippy::redundant_clone)]
22

33
use std::ops::Bound;
44
use std::sync::atomic::{AtomicUsize, Ordering};

crossbeam-skiplist/tests/map.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(clippy::mutex_atomic)]
2-
31
use std::{iter, ops::Bound, sync::Barrier};
42

53
use crossbeam_skiplist::SkipMap;

crossbeam-utils/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Version 0.8.12
2+
3+
- Removes the dependency on the `once_cell` crate to restore the MSRV. (#913)
4+
- Work around [rust-lang#98302](https://github.com/rust-lang/rust/issues/98302), which causes compile error on windows-gnu when LTO is enabled. (#913)
5+
16
# Version 0.8.11
27

38
- Bump the minimum supported Rust version to 1.38. (#877)

crossbeam-utils/Cargo.toml

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name = "crossbeam-utils"
44
# - Update CHANGELOG.md
55
# - Update README.md
66
# - Create "crossbeam-utils-X.Y.Z" git tag
7-
version = "0.8.11"
7+
version = "0.8.12"
88
edition = "2018"
99
rust-version = "1.38"
1010
license = "MIT OR Apache-2.0"
@@ -19,7 +19,7 @@ default = ["std"]
1919

2020
# Enable to use APIs that require `std`.
2121
# This is enabled by default.
22-
std = ["once_cell"]
22+
std = []
2323

2424
# These features are no longer used.
2525
# TODO: remove in the next major version.
@@ -32,7 +32,6 @@ nightly = []
3232

3333
[dependencies]
3434
cfg-if = "1"
35-
once_cell = { version = "1", optional = true }
3635

3736
# Enable the use of loom for concurrency testing.
3837
#

crossbeam-utils/src/cache_padded.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ use core::ops::{Deref, DerefMut};
3939
/// let addr1 = &*array[0] as *const i8 as usize;
4040
/// let addr2 = &*array[1] as *const i8 as usize;
4141
///
42-
/// assert!(addr2 - addr1 >= 64);
43-
/// assert_eq!(addr1 % 64, 0);
44-
/// assert_eq!(addr2 % 64, 0);
42+
/// assert!(addr2 - addr1 >= 32);
43+
/// assert_eq!(addr1 % 32, 0);
44+
/// assert_eq!(addr2 % 32, 0);
4545
/// ```
4646
///
4747
/// When building a concurrent queue with a head and a tail index, it is wise to place them in

crossbeam-utils/src/sync/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
//! * [`ShardedLock`], a sharded reader-writer lock with fast concurrent reads.
55
//! * [`WaitGroup`], for synchronizing the beginning or end of some computation.
66
7+
#[cfg(not(crossbeam_loom))]
8+
mod once_lock;
79
mod parker;
810
#[cfg(not(crossbeam_loom))]
911
mod sharded_lock;

0 commit comments

Comments
 (0)