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

Support creating static ArcStr's at runtime (leaking them) #55

Merged
merged 12 commits into from
May 6, 2024
117 changes: 37 additions & 80 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "00 01 * * *"

env:
RUST_BACKTRACE: short
Expand Down Expand Up @@ -42,8 +38,8 @@ jobs:
- nightly
- arm32
- arm64
- mips32
- mips64
- ppc32
- ppc64
include:
- build: linux
os: ubuntu-latest
Expand All @@ -63,14 +59,9 @@ jobs:
- build: win32-gnu
os: windows-2019
rust: stable-i686-gnu
# TODO: re-enable this I guess. I get inscrutable errors like
# `error reading from the zlib stream; class=Zlib (5)` in CI
# that don't repro locally, and I'm tired of getting an email
# about this every day.
#
# - build: msrv
# os: ubuntu-latest
# rust: "1.43.0"
- build: msrv
os: ubuntu-latest
rust: "1.57.0"
- build: beta
os: ubuntu-latest
rust: beta
Expand All @@ -90,16 +81,16 @@ jobs:
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
# Mips is big endian. Nothing currently in here cares... but will if I
# PPC is big endian. Nothing currently in here cares... but will if I
# ever get around to that `key` stuff.
- build: mips32
- build: ppc32
os: ubuntu-latest
rust: stable
target: mips-unknown-linux-gnu
- build: mips64
target: powerpc-unknown-linux-gnu
- build: ppc64
os: ubuntu-latest
rust: stable
target: mips64-unknown-linux-gnuabi64
target: powerpc64-unknown-linux-gnu
# Requested by a user not sure if it adds anything we aren't already
# testing but it's easy enough so *shrug*.
- build: riscv
Expand All @@ -108,12 +99,10 @@ jobs:
target: riscv64gc-unknown-linux-gnu

steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: hecrj/setup-rust-action@v2
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
rust-version: ${{ matrix.rust }}

- uses: taiki-e/install-action@cross
if: matrix.target != ''
Expand Down Expand Up @@ -145,76 +134,46 @@ jobs:
env:
RUSTFLAGS: --cfg loom -Dwarnings
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: actions/checkout@v4
- uses: hecrj/setup-rust-action@v2
- run: cargo test --all-features --lib
- run: cargo test --no-default-features --lib

miri:
name: Miri
runs-on: ubuntu-latest
env:
MIRIFLAGS: -Zmiri-tag-raw-pointers
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: hecrj/setup-rust-action@v2
with:
toolchain: nightly
rust-version: nightly
components: miri, rust-src
override: true
- run: cargo miri test --all-features
- run: cargo miri test --features="std serde substr"
- run: cargo miri test

cargo-clippy:
cargo-check:
name: Lint
runs-on: ubuntu-latest
env:
RUSTFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
minimal: true
override: true
- run: cargo clippy --workspace --all-targets --verbose
- run: cargo clippy --workspace --all-targets --verbose --all-features
- run: cargo clippy --workspace --all-targets --verbose --features="serde std substr"
- run: cargo clippy --workspace --all-targets --verbose --no-default-features
- uses: actions/checkout@v4
- uses: hecrj/setup-rust-action@v2
- run: cargo check --workspace --all-targets --verbose
- run: cargo check --workspace --all-targets --verbose --all-features
- run: cargo check --workspace --all-targets --verbose --features="serde std substr"
- run: cargo check --workspace --all-targets --verbose --no-default-features

# Ensure patch is formatted.
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
minimal: true
override: true
- uses: actions/checkout@v4
- uses: hecrj/setup-rust-action@v2
- run: cargo fmt --all -- --check

# Check doc reference links are all valid.
doc:
name: Doc check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
minimal: true
override: true
- run: cargo doc --features="serde std substr"

sanitizers:
name: Test sanitizer ${{ matrix.sanitizer }}
runs-on: ubuntu-latest
Expand All @@ -233,7 +192,7 @@ jobs:
extra_rustflags: "-Zsanitizer-memory-track-origins"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -251,17 +210,15 @@ jobs:
cargo -Zbuild-std test --target=x86_64-unknown-linux-gnu --all-features
cargo -Zbuild-std test --target=x86_64-unknown-linux-gnu --no-default-features

codecov:
name: Generate code coverage
codecov-tarpaulin:
name: coverage
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- run: cargo tarpaulin --verbose --doc --all-features --all-targets --engine llvm --out xml
- uses: codecov/codecov-action@v4
with:
toolchain: stable
override: true
- name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1
- name: Upload to codecov.io
uses: codecov/codecov-action@v1
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[package]
name = "arcstr"
version = "1.1.5"
rust-version = "1.57.0"
authors = ["Thom Chiovoloni <chiovolonit@gmail.com>"]
edition = "2018"
edition = "2021"
description = "A better reference-counted string type, with zero-cost (allocation-free) support for string literals, and reference counted substrings."
license = "Apache-2.0 OR MIT OR Zlib"
readme = "README.md"
Expand All @@ -29,10 +30,9 @@ serde = { version = "1", default-features = false, optional = true }

[dev-dependencies]
serde_test = { version = "1", default-features = false }
memoffset = "0.6"

[target.'cfg(loom)'.dev-dependencies]
loom = "0.5.6"
loom = "0.7.1"

[package.metadata.docs.rs]
features = ["std", "substr"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![codecov](https://codecov.io/gh/thomcc/arcstr/branch/main/graph/badge.svg)](https://codecov.io/gh/thomcc/arcstr)
[![Docs](https://docs.rs/arcstr/badge.svg)](https://docs.rs/arcstr)
[![Latest Version](https://img.shields.io/crates/v/arcstr.svg)](https://crates.io/crates/arcstr)
![Minimum Rust Version](https://img.shields.io/badge/MSRV%201.43-blue.svg)
![Minimum Rust Version](https://img.shields.io/badge/MSRV%201.57-blue.svg)

This crate defines `ArcStr`, a reference counted string type. It's essentially trying to be a better `Arc<str>` or `Arc<String>`, at least for most use cases.

Expand Down
Loading
Loading