Compare commits

...

11 Commits

Author SHA1 Message Date
John Nunley 2071dc75fd
Deprecate in favor of crossbeam-utils
With the release of `concurrent-queue` version 2, there are no major users of this crate left. This PR officially deprecates this crate.
2023-05-11 20:53:46 -07:00
Taiki Endo 4e12f87041 Enable dependabot update for Rust 2022-12-28 12:22:55 +09:00
Taiki Endo cddad24dc8 Clean up CI config 2022-12-28 12:22:55 +09:00
Taiki Endo 6d14c5c0a5 Remove msrv field from .clippy.toml
Since Rust 1.64, Clippy respects `rust-version` field in Cargo.toml.
rust-lang/rust@b776fb8
2022-12-28 12:22:55 +09:00
Taiki Endo 8b45665e19 Ignore clippy::clone_on_copy lint in test
```
warning: using `clone` on type `cache_padded::CachePadded<i32>` which implements the `Copy` trait
  --> tests/padding.rs:86:13
   |
86 |     let b = a.clone();
   |             ^^^^^^^^^ help: try removing the `clone` call: `a`
   |
   = note: `#[warn(clippy::clone_on_copy)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
```
2022-07-17 21:35:10 +09:00
Taiki Endo 0c1166ed10 Apply clippy to all targets 2022-07-17 21:21:36 +09:00
Taiki Endo d11a485852 Update CI config 2022-07-08 02:39:18 +09:00
Taiki Endo 5bc031be33 Update actions/checkout action to v3 2022-05-01 14:09:12 +09:00
Taiki Endo 2d7017155f Clean up CI config 2022-01-08 22:40:45 +09:00
Taiki Endo c892839b10 Update docs 2021-12-19 16:45:08 +09:00
Taiki Endo 1bce44b030 Update changelog 2021-12-19 14:50:21 +09:00
11 changed files with 108 additions and 95 deletions

9
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
commit-message:
prefix: ''
labels: []

View File

@ -1,43 +0,0 @@
name: Build and test
on:
push:
branches:
- master
pull_request:
jobs:
build_and_test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
rust: [nightly, beta, stable]
steps:
- uses: actions/checkout@v2
- name: Install latest ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
args: --all --bins --examples --tests --all-features
- name: Run cargo check (without dev-dependencies to catch missing feature flags)
if: startsWith(matrix.rust, 'nightly')
uses: actions-rs/cargo@v1
with:
command: check
args: -Z features=dev_dep
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test

78
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,78 @@
name: CI
on:
pull_request:
push:
branches:
- master
schedule:
- cron: '0 2 * * 0'
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings -A deprecated
RUSTDOCFLAGS: -D warnings
RUSTUP_MAX_RETRIES: 10
defaults:
run:
shell: bash
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
rust: [nightly, beta, stable]
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- run: cargo build --all --all-features --all-targets
- name: Run cargo check (without dev-dependencies to catch missing feature flags)
if: startsWith(matrix.rust, 'nightly')
run: cargo check -Z features=dev_dep
- run: cargo test
msrv:
runs-on: ubuntu-latest
strategy:
matrix:
# When updating this, the reminder to update the minimum supported
# Rust version in Cargo.toml.
rust: ['1.31']
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- run: cargo build
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update stable
- run: cargo clippy --all-features --all-targets
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update stable
- run: cargo fmt --all --check
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# https://github.com/rustsec/audit-check/issues/2
- uses: rustsec/audit-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,23 +0,0 @@
name: Lint
on:
push:
branches:
- master
pull_request:
jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features -- -W clippy::all

View File

@ -5,19 +5,12 @@ on:
tags:
- v[0-9]+.*
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: 1
jobs:
create-release:
if: github.repository_owner == 'smol-rs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup update stable
- run: cargo package
- uses: actions/checkout@v3
- uses: taiki-e/create-gh-release-action@v1
with:
changelog: CHANGELOG.md

View File

@ -1,17 +0,0 @@
name: Security audit
on:
push:
branches:
- master
pull_request:
jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,6 +1,10 @@
# Version 1.3.0
- This crate is now deprecated in favor of [crossbeam-utils::CachePadded](https://docs.rs/crossbeam-utils/latest/crossbeam_utils/struct.CachePadded.html).
# Version 1.2.0
- Improve implementation of `CachePadded`.
- Improve implementation of `CachePadded`. (#8)
# Version 1.1.1

View File

@ -3,12 +3,14 @@ name = "cache-padded"
# When publishing a new version:
# - Update CHANGELOG.md
# - Create "v1.x.y" git tag
version = "1.2.0"
version = "1.3.0"
authors = ["Stjepan Glavina <stjepang@gmail.com>"]
edition = "2018"
rust-version = "1.31"
description = "Prevent false sharing by padding and aligning to the length of a cache line"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/smol-rs/cache-padded"
homepage = "https://github.com/smol-rs/cache-padded"
keywords = ["cache", "padding", "lock-free", "atomic"]
categories = ["concurrency", "no-std"]
exclude = ["/.*"]

View File

@ -1,4 +1,4 @@
# cache-padded
# cache-padded (deprecated)
[![Build](https://github.com/smol-rs/cache-padded/workflows/Build%20and%20test/badge.svg)](
https://github.com/smol-rs/cache-padded/actions)
@ -9,6 +9,8 @@ https://crates.io/crates/cache-padded)
[![Documentation](https://docs.rs/cache-padded/badge.svg)](
https://docs.rs/cache-padded)
**This crate is now deprecated in favor of [crossbeam-utils::CachePadded](https://docs.rs/crossbeam-utils/latest/crossbeam_utils/struct.CachePadded.html).**
Prevent false sharing by padding and aligning to the length of a cache line.
In concurrent programming, sometimes it is desirable to make sure commonly accessed shared data
@ -21,7 +23,9 @@ data.
Cache lines are assumed to be N bytes long, depending on the architecture:
* On x86-64 and aarch64, N = 128.
* On x86-64, aarch64, and powerpc64, N = 128.
* On arm, mips, mips64, and riscv64, N = 32.
* On s390x, N = 256.
* On all others, N = 64.
Note that N is just a reasonable guess and is not guaranteed to match the actual cache line

View File

@ -13,6 +13,7 @@
//! * On x86-64, aarch64, and powerpc64, N = 128.
//! * On arm, mips, mips64, and riscv64, N = 32.
//! * On s390x, N = 256.
//! * On all others, N = 64.
//!
//! Note that N is just a reasonable guess and is not guaranteed to match the actual cache line
//! length of the machine the program is running on.
@ -56,6 +57,10 @@
#![no_std]
#![forbid(unsafe_code)]
#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms)]
#![deprecated(
since = "1.3.0",
note = "This crate is now deprecated in favor of [crossbeam-utils::CachePadded](https://docs.rs/crossbeam-utils/latest/crossbeam_utils/struct.CachePadded.html)."
)]
use core::fmt;
use core::ops::{Deref, DerefMut};

View File

@ -80,6 +80,7 @@ fn drops() {
assert_eq!(count.get(), 2);
}
#[allow(clippy::clone_on_copy)] // This is intentional
#[test]
fn clone() {
let a = CachePadded::new(17);