From fa68cc7ff5e95c64f636c69cb19ed42c7abd6ec5 Mon Sep 17 00:00:00 2001 From: tison Date: Mon, 27 Jul 2026 16:47:42 +0800 Subject: [PATCH 1/4] build: add xtask workflows --- .cargo/config.toml | 19 ++++ .github/workflows/ci.yml | 93 ++++++++++-------- AGENTS.md | 16 +++ Cargo.lock | 156 +++++++++++++++++++++++++++-- Cargo.toml | 17 +++- rust-toolchain.toml | 17 ++++ stacksafe/Cargo.toml | 1 + taplo.toml | 1 + xtask/Cargo.toml | 30 ++++++ xtask/src/main.rs | 206 +++++++++++++++++++++++++++++++++++++++ 10 files changed, 508 insertions(+), 48 deletions(-) create mode 100644 .cargo/config.toml create mode 100644 AGENTS.md create mode 100644 rust-toolchain.toml create mode 100644 xtask/Cargo.toml create mode 100644 xtask/src/main.rs diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..37825e9 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,19 @@ +# Copyright 2025 FastLabs Developers +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[alias] +x = "run --package x --" + +[env] +CARGO_WORKSPACE_DIR = { value = "", relative = true } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e22cac0..16cc7b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,10 @@ name: CI on: - push: - branches: [ main ] pull_request: branches: [ main ] + push: + branches: [ main ] # Concurrency strategy: # github.workflow: distinguish this workflow from others @@ -33,57 +33,70 @@ concurrency: group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.number || github.run_id }} cancel-in-progress: true -env: - CARGO_TERM_COLOR: always - jobs: check: + name: Check runs-on: ubuntu-24.04 - env: - FORCE_COLOR: 1 steps: - - uses: actions/checkout@v5 - - uses: Swatinem/rust-cache@v2 - - uses: dtolnay/rust-toolchain@master + - uses: actions/checkout@v7 + - name: Install toolchain + uses: dtolnay/rust-toolchain@nightly with: - toolchain: nightly components: rustfmt,clippy + - uses: Swatinem/rust-cache@v2 - uses: taiki-e/install-action@v2 with: tool: typos-cli,taplo-cli,hawkeye - - name: Cargo version - run: cargo --version - - name: Check format - run: cargo fmt --all -- --check - - name: Check clippy - run: cargo clippy --all-targets --all-features -- --deny warnings - - name: Check typos - run: typos - - name: Check taplo - run: taplo check - - name: Run hawkeye - run: hawkeye check + - run: cargo x lint + + msrv: + name: Resolve MSRV + runs-on: ubuntu-24.04 + outputs: + rust-versions: ${{ steps.metadata.outputs.rust-versions }} + steps: + - uses: actions/checkout@v7 + - id: metadata + run: | + msrv=$(yq '.workspace.package.rust-version' Cargo.toml) + echo "MSRV: $msrv" + echo "rust-versions=[\"${msrv}\", \"stable\"]" >> "$GITHUB_OUTPUT" test: - runs-on: ${{ matrix.os }} + name: Run tests + needs: msrv strategy: - fail-fast: false matrix: - os: [ windows-latest, macos-latest, ubuntu-latest ] - rust: [ "1.85.0", "stable", "nightly" ] - env: - RUST_BACKTRACE: 1 + os: [ ubuntu-24.04, macos-14, windows-2022 ] + rust-version: ${{ fromJson(needs.msrv.outputs.rust-versions) }} + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v7 - uses: Swatinem/rust-cache@v2 - - uses: dtolnay/rust-toolchain@master + - name: Delete rust-toolchain.toml + run: rm rust-toolchain.toml + - name: Install toolchain + uses: dtolnay/rust-toolchain@master with: - toolchain: ${{ matrix.rust }} - - name: Cargo version - run: cargo --version - - name: Build - run: cargo build --workspace --all-targets - - name: Build Release - run: cargo build --workspace --all-targets --release - - name: Run tests - run: cargo test -- --nocapture + toolchain: ${{ matrix.rust-version }} + - name: Run unit tests + run: cargo x test --no-capture + shell: bash + + required: + name: Required + runs-on: ubuntu-24.04 + if: ${{ always() }} + needs: + - check + - test + steps: + - name: Guardian + run: | + if [[ ! ( \ + "${{ needs.check.result }}" == "success" \ + && "${{ needs.test.result }}" == "success" \ + ) ]]; then + echo "Required jobs haven't been completed successfully." + exit -1 + fi diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..689d5be --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,16 @@ +# Agent Instructions + +## Cargo XTask + +Use `cargo x` as the source of truth for repository workflows. + +- Run `cargo x --help` before choosing build, test, lint, or formatting commands. +- Run `cargo x --help` for command-specific behavior. + +## Commits and Pull Requests + +Follow the semantic definition at `.github/semantic.yml`. + +- Keep title descriptions short. +- Simple PR descriptions should only include a `Summary` section. +- Complex PR descriptions may also include a `Design Notes` section. diff --git a/Cargo.lock b/Cargo.lock index bf6fcff..14e44b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,11 +2,61 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys", +] + [[package]] name = "ar_archive_writer" -version = "0.5.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4087686b4b0a3427190bae57a1d9a478dbb2d40c5dc1bd6e2b6d797913bdd348" +checksum = "f0c269894b6fe5e9d7ada0cf69b5bf847ff35bc25fc271f08e1d080fce80339a" dependencies = [ "object", ] @@ -27,6 +77,52 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "clap" +version = "4.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91e0c145792ef73a6ad36d27c75ac09f1832222a3c209689d90f534685ee5b7" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f09628afdcc538b57f3c6341e9c8e9970f18e4a481690a64974d7023bd33548b" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d012d2b9d65aca7f18f4d9878a045bc17899bba951561ba5ec3c2ba1eed9a061" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + [[package]] name = "equivalent" version = "1.0.2" @@ -51,6 +147,12 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "indexmap" version = "2.14.0" @@ -61,6 +163,12 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itoa" version = "1.0.18" @@ -81,13 +189,19 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "object" -version = "0.37.3" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "proc-macro2" version = "1.0.107" @@ -99,9 +213,9 @@ dependencies = [ [[package]] name = "psm" -version = "0.1.31" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645dbe486e346d9b5de3ef16ede18c26e6c70ad97418f4874b8b1889d6e761ea" +checksum = "d11f2fedc3b7dafdc2851bc52f277377c5473d378859be234bc7ebb593144d01" dependencies = [ "ar_archive_writer", "cc", @@ -190,6 +304,7 @@ dependencies = [ name = "stacksafe" version = "1.0.3" dependencies = [ + "psm", "serde", "stacker", "stacksafe-macro", @@ -205,6 +320,12 @@ dependencies = [ "syn", ] +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "syn" version = "3.0.3" @@ -291,6 +412,21 @@ version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "which" +version = "8.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f3ef584124b911bcc3875c2f1472e80f24361ceb789bd1c62b3e9a3df9ff43c" +dependencies = [ + "libc", +] + [[package]] name = "winapi-util" version = "0.1.11" @@ -321,6 +457,14 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +[[package]] +name = "x" +version = "0.0.0" +dependencies = [ + "clap", + "which", +] + [[package]] name = "zmij" version = "1.0.23" diff --git a/Cargo.toml b/Cargo.toml index f101732..8b0bc4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +13,8 @@ # limitations under the License. [workspace] -members = ["stacksafe", "stacksafe-macro"] -resolver = "2" +members = ["stacksafe", "stacksafe-macro", "xtask"] +resolver = "3" [workspace.package] edition = "2024" @@ -23,6 +23,16 @@ repository = "https://github.com/fast/stacksafe" rust-version = "1.85.0" version = "1.0.3" +[workspace.lints.rust] +unknown_lints = "deny" +unsafe_code = "deny" +unused_must_use = "deny" + +[workspace.lints.clippy] +dbg_macro = "deny" +too_many_arguments = "allow" +type_complexity = "allow" + [workspace.dependencies] # workspace dependencies stacksafe = { version = "1.0.3", path = "stacksafe" } @@ -30,6 +40,9 @@ stacksafe-macro = { version = "=1.0.3", path = "stacksafe-macro" } # crates.io dependencies proc-macro2 = { version = "1.0.106" } +# Pin stacker's transitive dependency to preserve Rust 1.85 support. +# See https://github.com/rust-lang/stacker/issues/139. +psm = { version = "=0.1.28" } quote = { version = "1.0.45" } serde = { version = "1.0.228" } stacker = { version = "0.1.24" } diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..5b7c2ec --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,17 @@ +# Copyright 2025 FastLabs Developers +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[toolchain] +channel = "stable" +components = ["cargo", "rustfmt", "clippy", "rust-analyzer"] diff --git a/stacksafe/Cargo.toml b/stacksafe/Cargo.toml index dccb4e9..12a2d29 100644 --- a/stacksafe/Cargo.toml +++ b/stacksafe/Cargo.toml @@ -36,6 +36,7 @@ rustdoc-args = ["--cfg", "docsrs"] serde = ["dep:serde"] [dependencies] +psm = { workspace = true } serde = { workspace = true, optional = true } stacker = { workspace = true } stacksafe-macro = { workspace = true } diff --git a/taplo.toml b/taplo.toml index f51fa16..78a4693 100644 --- a/taplo.toml +++ b/taplo.toml @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +exclude = ["target/**"] include = ["Cargo.toml", "**/*.toml"] [formatting] diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml new file mode 100644 index 0000000..638953e --- /dev/null +++ b/xtask/Cargo.toml @@ -0,0 +1,30 @@ +# Copyright 2025 FastLabs Developers +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[package] +name = "x" +publish = false + +edition.workspace = true +rust-version.workspace = true + +[package.metadata.release] +release = false + +[dependencies] +clap = { version = "4.6.1", features = ["derive"] } +which = { version = "8.0.4" } + +[lints] +workspace = true diff --git a/xtask/src/main.rs b/xtask/src/main.rs new file mode 100644 index 0000000..f75d6c9 --- /dev/null +++ b/xtask/src/main.rs @@ -0,0 +1,206 @@ +// Copyright 2025 FastLabs Developers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::path::Path; +use std::process::Command as StdCommand; + +use clap::Parser; +use clap::Subcommand; + +fn workspace_dir() -> &'static Path { + Path::new(env!("CARGO_WORKSPACE_DIR")) +} + +#[derive(Parser)] +#[clap(about = "Run repository tasks.")] +struct Command { + #[clap(subcommand)] + sub: SubCommand, +} + +impl Command { + fn run(self) { + match self.sub { + SubCommand::Build(cmd) => cmd.run(), + SubCommand::Lint(cmd) => cmd.run(), + SubCommand::Test(cmd) => cmd.run(), + } + } +} + +#[derive(Subcommand)] +enum SubCommand { + #[clap(about = "Compile all workspace targets.")] + Build(CommandBuild), + #[clap(about = "Run workspace quality checks.")] + Lint(CommandLint), + #[clap(about = "Run workspace unit tests.")] + Test(CommandTest), +} + +#[derive(Parser)] +struct CommandBuild { + #[arg(long, help = "Assert that `Cargo.lock` will remain unchanged.")] + locked: bool, +} + +impl CommandBuild { + fn run(self) { + run_command(make_build_cmd(self.locked)); + } +} + +#[derive(Parser)] +struct CommandTest { + #[arg(long, help = "Run tests serially and do not capture output.")] + no_capture: bool, +} + +impl CommandTest { + fn run(self) { + run_command(make_test_cmd(self.no_capture, &[])); + } +} + +#[derive(Parser)] +#[clap(name = "lint")] +struct CommandLint { + #[arg(long, help = "Automatically apply available lint and format fixes.")] + fix: bool, +} + +impl CommandLint { + fn run(self) { + run_command(make_clippy_cmd(self.fix)); + run_command(make_format_cmd(self.fix)); + run_command(make_taplo_cmd(self.fix)); + run_command(make_typos_cmd()); + run_command(make_hawkeye_cmd(self.fix)); + } +} + +fn find_command(cmd: &str) -> StdCommand { + match which::which(cmd) { + Ok(exe) => { + let mut cmd = StdCommand::new(exe); + cmd.current_dir(workspace_dir()); + cmd + } + Err(err) => { + panic!("{cmd} not found: {err}"); + } + } +} + +fn ensure_installed(bin: &str, crate_name: &str) { + if which::which(bin).is_err() { + let mut cmd = find_command("cargo"); + cmd.args(["install", crate_name]); + run_command(cmd); + } +} + +fn run_command(mut cmd: StdCommand) { + println!("{cmd:?}"); + let status = cmd.status().expect("failed to execute process"); + assert!(status.success(), "command failed: {status}"); +} + +fn make_build_cmd(locked: bool) -> StdCommand { + let mut cmd = find_command("cargo"); + cmd.args([ + "build", + "--workspace", + "--all-features", + "--tests", + "--examples", + "--benches", + "--bins", + ]); + if locked { + cmd.arg("--locked"); + } + cmd +} + +fn make_test_cmd(no_capture: bool, features: &[&str]) -> StdCommand { + let mut cmd = find_command("cargo"); + cmd.args(["test", "--workspace", "--no-default-features"]); + if !features.is_empty() { + cmd.args(["--features", features.join(",").as_str()]); + } + if no_capture { + cmd.args(["--", "--nocapture"]); + } + cmd +} + +fn make_format_cmd(fix: bool) -> StdCommand { + let mut cmd = find_command("cargo"); + cmd.args(["+nightly", "fmt", "--all"]); + if !fix { + cmd.arg("--check"); + } + cmd +} + +fn make_clippy_cmd(fix: bool) -> StdCommand { + let mut cmd = find_command("cargo"); + cmd.args([ + "+nightly", + "clippy", + "--tests", + "--all-features", + "--all-targets", + "--workspace", + ]); + if fix { + cmd.args(["--allow-staged", "--allow-dirty", "--fix"]); + } else { + cmd.args(["--", "-D", "warnings"]); + } + cmd +} + +fn make_hawkeye_cmd(fix: bool) -> StdCommand { + ensure_installed("hawkeye", "hawkeye"); + let mut cmd = find_command("hawkeye"); + if fix { + cmd.args(["format", "--fail-if-updated=false"]); + } else { + cmd.args(["check"]); + } + cmd +} + +fn make_typos_cmd() -> StdCommand { + ensure_installed("typos", "typos-cli"); + find_command("typos") +} + +fn make_taplo_cmd(fix: bool) -> StdCommand { + ensure_installed("taplo", "taplo-cli"); + let mut cmd = find_command("taplo"); + if fix { + cmd.args(["format"]); + } else { + cmd.args(["format", "--check"]); + } + cmd +} + +fn main() { + let cmd = Command::parse(); + cmd.run() +} From ace47194657f7a3cbb6ecc45209d9769956131a7 Mon Sep 17 00:00:00 2001 From: tison Date: Mon, 27 Jul 2026 16:56:56 +0800 Subject: [PATCH 2/4] ci: restore release builds --- .github/workflows/ci.yml | 6 ++++++ xtask/src/main.rs | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16cc7b8..5b86c45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,6 +79,12 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust-version }} + - name: Build + run: cargo x build --locked + shell: bash + - name: Build release + run: cargo x build --locked --release + shell: bash - name: Run unit tests run: cargo x test --no-capture shell: bash diff --git a/xtask/src/main.rs b/xtask/src/main.rs index f75d6c9..867a40a 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -53,11 +53,13 @@ enum SubCommand { struct CommandBuild { #[arg(long, help = "Assert that `Cargo.lock` will remain unchanged.")] locked: bool, + #[arg(long, help = "Build artifacts in release mode.")] + release: bool, } impl CommandBuild { fn run(self) { - run_command(make_build_cmd(self.locked)); + run_command(make_build_cmd(self.locked, self.release)); } } @@ -117,7 +119,7 @@ fn run_command(mut cmd: StdCommand) { assert!(status.success(), "command failed: {status}"); } -fn make_build_cmd(locked: bool) -> StdCommand { +fn make_build_cmd(locked: bool, release: bool) -> StdCommand { let mut cmd = find_command("cargo"); cmd.args([ "build", @@ -131,6 +133,9 @@ fn make_build_cmd(locked: bool) -> StdCommand { if locked { cmd.arg("--locked"); } + if release { + cmd.arg("--release"); + } cmd } From 164c423c574147bb1f5b92f6cc0c7677c6472fd6 Mon Sep 17 00:00:00 2001 From: tison Date: Mon, 27 Jul 2026 17:12:06 +0800 Subject: [PATCH 3/4] fix: exclude xtask from workspace builds --- xtask/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 867a40a..8418a06 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -124,6 +124,8 @@ fn make_build_cmd(locked: bool, release: bool) -> StdCommand { cmd.args([ "build", "--workspace", + "--exclude", + "x", "--all-features", "--tests", "--examples", From 21c15a3ba1404328bc4b9663a41e56c4a7e03a41 Mon Sep 17 00:00:00 2001 From: tison Date: Tue, 28 Jul 2026 08:05:29 +0800 Subject: [PATCH 4/4] build: raise MSRV to 1.88 --- Cargo.lock | 13 ++++++------- Cargo.toml | 5 +---- README.md | 2 +- stacksafe/Cargo.toml | 1 - 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 14e44b0..4434b9a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,9 +54,9 @@ dependencies = [ [[package]] name = "ar_archive_writer" -version = "0.2.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c269894b6fe5e9d7ada0cf69b5bf847ff35bc25fc271f08e1d080fce80339a" +checksum = "4087686b4b0a3427190bae57a1d9a478dbb2d40c5dc1bd6e2b6d797913bdd348" dependencies = [ "object", ] @@ -189,9 +189,9 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "object" -version = "0.32.2" +version = "0.37.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" dependencies = [ "memchr", ] @@ -213,9 +213,9 @@ dependencies = [ [[package]] name = "psm" -version = "0.1.28" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d11f2fedc3b7dafdc2851bc52f277377c5473d378859be234bc7ebb593144d01" +checksum = "645dbe486e346d9b5de3ef16ede18c26e6c70ad97418f4874b8b1889d6e761ea" dependencies = [ "ar_archive_writer", "cc", @@ -304,7 +304,6 @@ dependencies = [ name = "stacksafe" version = "1.0.3" dependencies = [ - "psm", "serde", "stacker", "stacksafe-macro", diff --git a/Cargo.toml b/Cargo.toml index 8b0bc4c..69bb953 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ resolver = "3" edition = "2024" license = "Apache-2.0" repository = "https://github.com/fast/stacksafe" -rust-version = "1.85.0" +rust-version = "1.88.0" version = "1.0.3" [workspace.lints.rust] @@ -40,9 +40,6 @@ stacksafe-macro = { version = "=1.0.3", path = "stacksafe-macro" } # crates.io dependencies proc-macro2 = { version = "1.0.106" } -# Pin stacker's transitive dependency to preserve Rust 1.85 support. -# See https://github.com/rust-lang/stacker/issues/139. -psm = { version = "=0.1.28" } quote = { version = "1.0.45" } serde = { version = "1.0.228" } stacker = { version = "0.1.24" } diff --git a/README.md b/README.md index bb3b271..a6a457b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Crates.io](https://img.shields.io/crates/v/stacksafe.svg?style=flat-square&logo=rust)](https://crates.io/crates/stacksafe) [![Documentation](https://img.shields.io/docsrs/stacksafe?style=flat-square&logo=rust)](https://docs.rs/stacksafe/) -[![MSRV 1.85.0](https://img.shields.io/badge/MSRV-1.85.0-green?style=flat-square&logo=rust)](https://www.whatrustisit.com) +[![MSRV 1.88.0](https://img.shields.io/badge/MSRV-1.88.0-green?style=flat-square&logo=rust)](https://www.whatrustisit.com) [![CI Status](https://img.shields.io/github/actions/workflow/status/fast/stacksafe/ci.yml?style=flat-square&logo=github)](https://github.com/fast/stacksafe/actions) StackSafe prevents stack overflows in deeply recursive algorithms by providing intelligent stack management. No more crashes from recursive functions or data structures that exceed the default stack size - StackSafe automatically allocates additional stack space when needed, eliminating the need for manual stack size tuning or complex refactoring to iterative approaches. diff --git a/stacksafe/Cargo.toml b/stacksafe/Cargo.toml index 12a2d29..dccb4e9 100644 --- a/stacksafe/Cargo.toml +++ b/stacksafe/Cargo.toml @@ -36,7 +36,6 @@ rustdoc-args = ["--cfg", "docsrs"] serde = ["dep:serde"] [dependencies] -psm = { workspace = true } serde = { workspace = true, optional = true } stacker = { workspace = true } stacksafe-macro = { workspace = true }