From 4d5d5743f8beca27bf282cb25cf22a37471477e7 Mon Sep 17 00:00:00 2001 From: Mike Foster Date: Sat, 11 Apr 2026 17:44:00 +0000 Subject: [PATCH 1/5] don't use setup action - has some issues with clippy and autocfg --- .github/workflows/rust-stability.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rust-stability.yml b/.github/workflows/rust-stability.yml index 466a245..2319ccb 100644 --- a/.github/workflows/rust-stability.yml +++ b/.github/workflows/rust-stability.yml @@ -2,6 +2,7 @@ name: Monthly stability checks on: workflow_dispatch: + workflow_call: pull_request: schedule: - cron: '0 3 6 * *' @@ -15,7 +16,6 @@ env: RUSTC_BOOTSTRAP: 1 jobs: - test: strategy: @@ -25,11 +25,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: ${{ matrix.channel }} + - name: update rust + run: rustup update - name: Run tests - run: cargo test --no-fail-fast + run: cargo +${{ matrix.channel }} test --no-fail-fast lint: strategy: @@ -39,12 +38,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: ${{ matrix.channel }} - components: "clippy" + - name: update rust + run: rustup update && rustup component add --toolchain ${{ matrix.channel }} clippy - name: clippy - run: cargo clippy -- --deny warnings + run: cargo +${{ matrix.channel }} clippy -- --deny warnings report: if: ${{ always() }} From c52e878ec8b7a26fe5ab12886898f068932bdfb2 Mon Sep 17 00:00:00 2001 From: Mike Foster Date: Sat, 11 Apr 2026 17:48:16 +0000 Subject: [PATCH 2/5] check location of macro in build.rs --- build.rs | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++- src/lib.rs | 4 ++-- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/build.rs b/build.rs index 23817e3..e68b4ee 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,59 @@ +use autocfg::AutoCfg; + extern crate autocfg; fn main() { let ac = autocfg::new(); - ac.emit_path_cfg("std::assert_matches", "stable_assert_matches"); + stable_feature(&ac, "assert_matches"); + assert_matches_in_module(&ac); + assert_matches_in_root(&ac); +} + +fn stable_feature(ac: &AutoCfg, feature: &'static str) { + let cfg = format!("stable_{feature}"); + let code = format!( + r#" + #![deny(stable_features)] + #![feature({feature})] + "# + ); + + autocfg::emit_possibility(&cfg); + if ac.probe_raw(&code).is_err() { + autocfg::emit(&cfg); + } +} + +fn assert_matches_in_root(ac: &AutoCfg) { + let cfg = "assert_matches_in_root"; + let code = r#" + #![allow(stable_features)] + #![feature(assert_matches)] + use std::assert_matches; + + fn main() { + assert_matches!(Some(4), Some(_)); + } + "#; + autocfg::emit_possibility(cfg); + if ac.probe_raw(code).is_ok() { + autocfg::emit(cfg); + } +} + +fn assert_matches_in_module(ac: &AutoCfg) { + let cfg = "assert_matches_in_module"; + let code = r#" + #![allow(stable_features)] + #![feature(assert_matches)] + use std::assert_matches::assert_matches; + + fn main() { + assert_matches!(Some(4), Some(_)); + } + "#; + autocfg::emit_possibility(cfg); + if ac.probe_raw(code).is_ok() { + autocfg::emit(cfg); + } } diff --git a/src/lib.rs b/src/lib.rs index b8f4c47..0f98fe7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -603,10 +603,10 @@ impl From for TokenStream1 { #[cfg(test)] mod tests { - #[cfg(not(stable_assert_matches))] + #[cfg(assert_matches_in_module)] use std::assert_matches::assert_matches; - #[cfg(stable_assert_matches)] + #[cfg(assert_matches_in_root)] use std::assert_matches; use super::*; From 38fbee66addc9de16770c7f53679e7f6de718809 Mon Sep 17 00:00:00 2001 From: Mike Foster Date: Sat, 11 Apr 2026 17:51:18 +0000 Subject: [PATCH 3/5] don't lint tests (clippy --tests has issues with autocfg when run on github CI) --- .github/workflows/rust.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 01b9e28..10efa09 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -46,8 +46,6 @@ jobs: - uses: actions/checkout@v6 - name: clippy run: cargo clippy -- --deny warnings - - name: clippy the tests - run: cargo clippy --tests -- --deny warnings fmt: needs: skip_check From 7553f64e8dfefc31aaf82f6fcbc24dae1662f27f Mon Sep 17 00:00:00 2001 From: Mike Foster Date: Sat, 11 Apr 2026 17:53:16 +0000 Subject: [PATCH 4/5] remove unneeded extern crate from build.rs --- build.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.rs b/build.rs index e68b4ee..dd4c335 100644 --- a/build.rs +++ b/build.rs @@ -1,7 +1,5 @@ use autocfg::AutoCfg; -extern crate autocfg; - fn main() { let ac = autocfg::new(); stable_feature(&ac, "assert_matches"); From 8a5721d2e519e4255f1a5b7dde0bb5684885aebc Mon Sep 17 00:00:00 2001 From: Mike Foster Date: Sat, 11 Apr 2026 17:54:14 +0000 Subject: [PATCH 5/5] deploy from nightly with 3-channel checks --- .github/workflows/deploy-rust.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-rust.yml b/.github/workflows/deploy-rust.yml index 8a00ff5..8df40ac 100644 --- a/.github/workflows/deploy-rust.yml +++ b/.github/workflows/deploy-rust.yml @@ -7,11 +7,13 @@ on: env: CARGO_TERM_COLOR: always - RUSTC_BOOTSTRAP: 1 jobs: quality-check: - uses: ./.github/workflows/rust.yml + permissions: + contents: read + issues: write + uses: ./.github/workflows/rust-stability.yml publish: environment: crates.io @@ -23,4 +25,4 @@ jobs: env: CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} run: - cargo publish + cargo +nightly publish