Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.8: Prepare for the next release #914

Merged
merged 15 commits into from Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .clippy.toml

This file was deleted.

56 changes: 27 additions & 29 deletions .github/workflows/ci.yml
Expand Up @@ -58,9 +58,9 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Rust
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- name: Install cross
uses: taiki-e/install-action@cross
if: matrix.target != ''
Expand All @@ -80,8 +80,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Check features
Expand All @@ -92,10 +93,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update nightly && rustup default nightly
- uses: dtolnay/rust-toolchain@nightly
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Install cargo-minimal-versions
uses: taiki-e/install-action@cargo-minimal-versions
- name: dependency tree check
run: ./ci/dependencies.sh

Expand All @@ -107,8 +109,7 @@ jobs:
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update nightly && rustup default nightly
- uses: dtolnay/rust-toolchain@nightly
- run: ci/no_atomic.sh
- run: git add -N . && git diff --exit-code
if: github.repository_owner != 'crossbeam-rs' || github.event_name != 'schedule'
Expand Down Expand Up @@ -140,28 +141,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update stable
- uses: dtolnay/rust-toolchain@stable
- name: rustfmt
run: ./ci/rustfmt.sh

# Check clippy.
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update stable
- name: clippy
run: ./ci/clippy.sh
# This branch no longer actively developed. Most commits to this
# branch are backporting and should not be blocked by clippy.
# # Check clippy.
# clippy:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: dtolnay/rust-toolchain@stable
# - name: clippy
# run: ./ci/clippy.sh

# Run miri.
miri:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup toolchain install nightly --component miri && rustup default nightly
- uses: dtolnay/rust-toolchain@miri
- name: miri
run: ./ci/miri.sh

Expand All @@ -170,8 +170,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update nightly && rustup default nightly
- uses: dtolnay/rust-toolchain@nightly
- name: Run sanitizers
run: ./ci/san.sh

Expand All @@ -180,8 +179,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update stable
- uses: dtolnay/rust-toolchain@stable
- name: loom
run: ./ci/crossbeam-epoch-loom.sh

Expand All @@ -190,8 +188,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update nightly && rustup default nightly
- uses: dtolnay/rust-toolchain@nightly
- name: docs
run: ./ci/docs.sh

Expand All @@ -218,11 +215,12 @@ jobs:
- dependencies
- codegen
- rustfmt
- clippy
# - clippy
- miri
- san
- loom
- docs
- shellcheck
runs-on: ubuntu-latest
steps:
- name: Mark the job as a success
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/release.yml
Expand Up @@ -9,10 +9,6 @@ on:
- crossbeam-[0-9]+.*
- crossbeam-[a-z]+-[0-9]+.*

env:
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1

defaults:
run:
shell: bash
Expand Down
8 changes: 1 addition & 7 deletions ci/dependencies.sh
Expand Up @@ -7,10 +7,4 @@ cargo tree
cargo tree --duplicate

# Check minimal versions.
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`
# from determining minimal versions based on dev-dependencies.
cargo hack --remove-dev-deps --workspace
# Update Cargo.lock to minimal version dependencies.
cargo update -Zminimal-versions
cargo tree
cargo hack check --all --all-features --exclude benchmarks
cargo minimal-versions build --workspace --all-features --exclude benchmarks
2 changes: 1 addition & 1 deletion ci/rustfmt.sh
Expand Up @@ -5,4 +5,4 @@ cd "$(dirname "$0")"/..

rustup component add rustfmt

cargo fmt --all -- --check
cargo fmt --all --check
2 changes: 1 addition & 1 deletion crossbeam-channel/src/channel.rs
Expand Up @@ -160,7 +160,7 @@ pub fn bounded<T>(cap: usize) -> (Sender<T>, Receiver<T>) {
/// let ms = |ms| Duration::from_millis(ms);
///
/// // Returns `true` if `a` and `b` are very close `Instant`s.
/// let eq = |a, b| a + ms(50) > b && b + ms(50) > a;
/// let eq = |a, b| a + ms(60) > b && b + ms(60) > a;
///
/// let start = Instant::now();
/// let r = after(ms(100));
Expand Down
2 changes: 1 addition & 1 deletion crossbeam-channel/tests/golang.rs
Expand Up @@ -9,7 +9,7 @@
//! - https://golang.org/LICENSE
//! - https://golang.org/PATENTS

#![allow(clippy::mutex_atomic, clippy::redundant_clone)]
#![allow(clippy::redundant_clone)]

use std::alloc::{GlobalAlloc, Layout, System};
use std::any::Any;
Expand Down
1 change: 1 addition & 0 deletions crossbeam-channel/tests/ready.rs
Expand Up @@ -229,6 +229,7 @@ fn default_when_disconnected() {
}

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

Expand Down
1 change: 0 additions & 1 deletion crossbeam-deque/src/lib.rs
Expand Up @@ -95,7 +95,6 @@
rust_2018_idioms,
unreachable_pub
)]
#![allow(clippy::question_mark)] // https://github.com/rust-lang/rust-clippy/issues/8281
#![cfg_attr(not(feature = "std"), no_std)]

use cfg_if::cfg_if;
Expand Down
5 changes: 5 additions & 0 deletions crossbeam-epoch/CHANGELOG.md
@@ -1,3 +1,8 @@
# Version 0.9.11

- Removes the dependency on the `once_cell` crate to restore the MSRV. (#913)
- 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)

# Version 0.9.10

- Bump the minimum supported Rust version to 1.38. (#877)
Expand Down
5 changes: 2 additions & 3 deletions crossbeam-epoch/Cargo.toml
Expand Up @@ -4,7 +4,7 @@ name = "crossbeam-epoch"
# - Update CHANGELOG.md
# - Update README.md
# - Create "crossbeam-epoch-X.Y.Z" git tag
version = "0.9.10"
version = "0.9.11"
edition = "2018"
rust-version = "1.38"
license = "MIT OR Apache-2.0"
Expand All @@ -19,7 +19,7 @@ default = ["std"]

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

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

# Enable the use of loom for concurrency testing.
Expand Down
34 changes: 21 additions & 13 deletions crossbeam-epoch/src/default.rs
Expand Up @@ -8,22 +8,30 @@ use crate::collector::{Collector, LocalHandle};
use crate::guard::Guard;
use crate::primitive::thread_local;
#[cfg(not(crossbeam_loom))]
use once_cell::sync::Lazy;
use crate::sync::once_lock::OnceLock;

/// The global data for the default garbage collector.
#[cfg(not(crossbeam_loom))]
static COLLECTOR: Lazy<Collector> = Lazy::new(Collector::new);
// FIXME: loom does not currently provide the equivalent of Lazy:
// https://github.com/tokio-rs/loom/issues/263
#[cfg(crossbeam_loom)]
loom::lazy_static! {
/// The global data for the default garbage collector.
static ref COLLECTOR: Collector = Collector::new();
fn collector() -> &'static Collector {
#[cfg(not(crossbeam_loom))]
{
/// The global data for the default garbage collector.
static COLLECTOR: OnceLock<Collector> = OnceLock::new();
COLLECTOR.get_or_init(Collector::new)
}
// FIXME: loom does not currently provide the equivalent of Lazy:
// https://github.com/tokio-rs/loom/issues/263
#[cfg(crossbeam_loom)]
{
loom::lazy_static! {
/// The global data for the default garbage collector.
static ref COLLECTOR: Collector = Collector::new();
}
&COLLECTOR
}
}

thread_local! {
/// The per-thread participant for the default garbage collector.
static HANDLE: LocalHandle = COLLECTOR.register();
static HANDLE: LocalHandle = collector().register();
}

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

/// Returns the default global collector.
pub fn default_collector() -> &'static Collector {
&COLLECTOR
collector()
}

#[inline]
Expand All @@ -50,7 +58,7 @@ where
{
HANDLE
.try_with(|h| f(h))
.unwrap_or_else(|_| f(&COLLECTOR.register()))
.unwrap_or_else(|_| f(&collector().register()))
}

#[cfg(all(test, not(crossbeam_loom)))]
Expand Down
2 changes: 1 addition & 1 deletion crossbeam-epoch/src/lib.rs
Expand Up @@ -107,7 +107,7 @@ mod primitive {
// https://github.com/tokio-rs/loom#handling-loom-api-differences
impl<T> UnsafeCell<T> {
#[inline]
pub(crate) fn new(data: T) -> UnsafeCell<T> {
pub(crate) const fn new(data: T) -> UnsafeCell<T> {
UnsafeCell(::core::cell::UnsafeCell::new(data))
}

Expand Down
3 changes: 3 additions & 0 deletions crossbeam-epoch/src/sync/mod.rs
@@ -1,4 +1,7 @@
//! Synchronization primitives.

pub(crate) mod list;
#[cfg(feature = "std")]
#[cfg(not(crossbeam_loom))]
pub(crate) mod once_lock;
pub(crate) mod queue;
1 change: 1 addition & 0 deletions crossbeam-epoch/src/sync/once_lock.rs
2 changes: 1 addition & 1 deletion crossbeam-skiplist/tests/base.rs
@@ -1,4 +1,4 @@
#![allow(clippy::mutex_atomic, clippy::redundant_clone)]
#![allow(clippy::redundant_clone)]

use std::ops::Bound;
use std::sync::atomic::{AtomicUsize, Ordering};
Expand Down
2 changes: 0 additions & 2 deletions crossbeam-skiplist/tests/map.rs
@@ -1,5 +1,3 @@
#![allow(clippy::mutex_atomic)]

use std::{iter, ops::Bound, sync::Barrier};

use crossbeam_skiplist::SkipMap;
Expand Down
5 changes: 5 additions & 0 deletions crossbeam-utils/CHANGELOG.md
@@ -1,3 +1,8 @@
# Version 0.8.12

- Removes the dependency on the `once_cell` crate to restore the MSRV. (#913)
- 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)

# Version 0.8.11

- Bump the minimum supported Rust version to 1.38. (#877)
Expand Down
5 changes: 2 additions & 3 deletions crossbeam-utils/Cargo.toml
Expand Up @@ -4,7 +4,7 @@ name = "crossbeam-utils"
# - Update CHANGELOG.md
# - Update README.md
# - Create "crossbeam-utils-X.Y.Z" git tag
version = "0.8.11"
version = "0.8.12"
edition = "2018"
rust-version = "1.38"
license = "MIT OR Apache-2.0"
Expand All @@ -19,7 +19,7 @@ default = ["std"]

# Enable to use APIs that require `std`.
# This is enabled by default.
std = ["once_cell"]
std = []

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

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

# Enable the use of loom for concurrency testing.
#
Expand Down
6 changes: 3 additions & 3 deletions crossbeam-utils/src/cache_padded.rs
Expand Up @@ -39,9 +39,9 @@ use core::ops::{Deref, DerefMut};
/// let addr1 = &*array[0] as *const i8 as usize;
/// let addr2 = &*array[1] as *const i8 as usize;
///
/// assert!(addr2 - addr1 >= 64);
/// assert_eq!(addr1 % 64, 0);
/// assert_eq!(addr2 % 64, 0);
/// assert!(addr2 - addr1 >= 32);
/// assert_eq!(addr1 % 32, 0);
/// assert_eq!(addr2 % 32, 0);
/// ```
///
/// When building a concurrent queue with a head and a tail index, it is wise to place them in
Expand Down
2 changes: 2 additions & 0 deletions crossbeam-utils/src/sync/mod.rs
Expand Up @@ -4,6 +4,8 @@
//! * [`ShardedLock`], a sharded reader-writer lock with fast concurrent reads.
//! * [`WaitGroup`], for synchronizing the beginning or end of some computation.

#[cfg(not(crossbeam_loom))]
mod once_lock;
mod parker;
#[cfg(not(crossbeam_loom))]
mod sharded_lock;
Expand Down