Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 44 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,23 @@ jobs:
- rust: nightly
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- rust: nightly
os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
# Test 32-bit target that does not have AtomicU64/AtomicI64.
- rust: nightly
os: ubuntu-latest
target: armv5te-unknown-linux-gnueabi
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- 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 }}
- name: Install cross
uses: taiki-e/install-action@cross
- uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
if: matrix.target != ''
- name: Test
run: ci/test.sh
Expand All @@ -83,8 +88,9 @@ jobs:
- msrv
- nightly
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
if: matrix.rust != 'msrv'
Expand All @@ -96,8 +102,9 @@ jobs:
# Check for duplicate dependencies.
dependencies:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup update nightly && rustup default nightly
- name: Install cargo-hack
Expand All @@ -113,8 +120,9 @@ jobs:
permissions:
contents: write
pull-requests: write
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup update stable
- run: ci/no_atomic.sh
Expand Down Expand Up @@ -146,8 +154,9 @@ jobs:
# Check formatting.
rustfmt:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup update stable
- name: rustfmt
Expand All @@ -158,8 +167,9 @@ jobs:
# # Check clippy.
# clippy:
# runs-on: ubuntu-latest
# timeout-minutes: 60
# steps:
# - uses: actions/checkout@v4
# - uses: taiki-e/checkout-action@v1
# - name: Install Rust
# run: rustup update stable
# - name: clippy
Expand All @@ -168,28 +178,46 @@ jobs:
# Run miri.
miri:
runs-on: ubuntu-latest
timeout-minutes: 120 # TODO
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup toolchain install nightly --component miri && rustup default nightly
- name: miri
run: ci/miri.sh

# Run cargo-careful.
careful:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup toolchain install nightly --component rust-src && rustup default nightly
- name: Install cargo-careful
run: cargo install cargo-careful --locked --debug
- name: Run cargo-careful
run: ./ci/careful.sh

# Run sanitizers.
san:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup update nightly && rustup default nightly
# https://github.com/google/sanitizers/issues/1716 / https://github.com/actions/runner-images/issues/9491
- run: sudo sysctl vm.mmap_rnd_bits=28
- name: Run sanitizers
run: ci/san.sh

# Run loom tests.
loom:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup update stable
- name: loom
Expand All @@ -198,17 +226,19 @@ jobs:
# Check if the document can be generated without warning.
docs:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup update nightly && rustup default nightly
- name: docs
run: cargo doc --no-deps --all --all-features

shellcheck:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install shellcheck
uses: taiki-e/install-action@shellcheck
- run: shellcheck $(git ls-files '*.sh')
Expand All @@ -230,6 +260,7 @@ jobs:
- rustfmt
# - clippy
- miri
- careful
- san
- loom
- docs
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ jobs:
create-release:
if: github.repository_owner == 'crossbeam-rs'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- uses: taiki-e/create-gh-release-action@v1
with:
prefix: crossbeam(-[a-z]+)?
Expand Down
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ crossbeam-utils = { version = "0.8.18", path = "crossbeam-utils", default-featur
[dev-dependencies]
rand = "0.8"

[lints]
workspace = true

[workspace]
resolver = "2"
members = [
Expand All @@ -62,3 +65,9 @@ members = [
"crossbeam-skiplist",
"crossbeam-utils",
]

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(crossbeam_loom)',
'cfg(crossbeam_sanitize)',
] }
8 changes: 8 additions & 0 deletions ci/careful.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -euxo pipefail
IFS=$'\n\t'
cd "$(dirname "$0")"/..

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

cargo careful test --all --all-features --exclude benchmarks -- --test-threads=1
4 changes: 2 additions & 2 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ set -euxo pipefail
IFS=$'\n\t'
cd "$(dirname "$0")"/..

# shellcheck disable=SC2086
if [[ -n "${RUST_TARGET:-}" ]]; then
# If RUST_TARGET is specified, use cross for testing.
cross test --all --target "$RUST_TARGET" --exclude benchmarks -- --test-threads=1
cargo test --all --target "$RUST_TARGET" --exclude benchmarks ${DOCTEST_XCOMPILE:-} -- --test-threads=1

# For now, the non-host target only runs tests.
exit 0
Expand Down
4 changes: 4 additions & 0 deletions crossbeam-channel/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Version 0.5.13

- Add `select_biased!` macro. (#1040)

# Version 0.5.12

- Fix memory leak in unbounded channel. (#1084)
Expand Down
5 changes: 4 additions & 1 deletion crossbeam-channel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "crossbeam-channel"
# - Update CHANGELOG.md
# - Update README.md (when increasing major or minor version)
# - Run './tools/publish.sh crossbeam-channel <version>'
version = "0.5.12"
version = "0.5.13"
edition = "2021"
rust-version = "1.60"
license = "MIT OR Apache-2.0"
Expand All @@ -30,3 +30,6 @@ crossbeam-utils = { version = "0.8.18", path = "../crossbeam-utils", default-fea
num_cpus = "1.13.0"
rand = "0.8"
signal-hook = "0.3"

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crossbeam-channel/benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,6 @@ doc = false
name = "mpmc"
path = "mpmc.rs"
doc = false

[lints]
workspace = true
2 changes: 1 addition & 1 deletion crossbeam-channel/src/flavors/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl<T> Channel<T> {
let slot = unsafe { self.buffer.get_unchecked(index) };
let stamp = slot.stamp.load(Ordering::Acquire);

// If the the stamp is ahead of the head by 1, we may attempt to pop.
// If the stamp is ahead of the head by 1, we may attempt to pop.
if head + 1 == stamp {
let new = if index + 1 < self.cap {
// Same lap, incremented index.
Expand Down
3 changes: 3 additions & 0 deletions crossbeam-channel/src/flavors/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,9 @@ impl<T> Channel<T> {
}

let mut head = self.head.index.load(Ordering::Acquire);
// The channel may be uninitialized, so we have to swap to avoid overwriting any sender's attempts
// to initialize the first block before noticing that the receivers disconnected. Late allocations
// will be deallocated by the sender in Drop
let mut block = self.head.block.swap(ptr::null_mut(), Ordering::AcqRel);

// If we're going to be dropping messages we need to synchronize with initialization
Expand Down
Loading