diff --git a/.github/actions/rust-toolchain/action.yml b/.github/actions/rust-toolchain/action.yml new file mode 100644 index 000000000..3a5704e04 --- /dev/null +++ b/.github/actions/rust-toolchain/action.yml @@ -0,0 +1,36 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. +# All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +name: Rust toolchain +description: >- + Install the toolchain from packages/diskgraph/rust-toolchain.toml with the + runner's rustup and make it the default. +inputs: + components: + description: Additional rustup components, space separated. + required: false + default: '' +runs: + using: composite + steps: + - name: Install the pinned Rust toolchain + shell: bash + working-directory: packages/diskgraph + env: + COMPONENTS: ${{ inputs.components }} + run: | + set -euo pipefail + rustup toolchain install --profile minimal --no-self-update + toolchain="$(rustup show active-toolchain | cut -d' ' -f1)" + rustup default "$toolchain" + if [ -n "$COMPONENTS" ]; then + # shellcheck disable=SC2086 # space-separated list + rustup component add --toolchain "$toolchain" $COMPONENTS + fi + if [ "$RUNNER_OS" != Windows ]; then + echo "CARGO_HOME=${CARGO_HOME:-$HOME/.cargo}" >> "$GITHUB_ENV" + fi + [ -n "${CARGO_INCREMENTAL+set}" ] || echo CARGO_INCREMENTAL=0 >> "$GITHUB_ENV" + [ -n "${CARGO_TERM_COLOR+set}" ] || echo CARGO_TERM_COLOR=always >> "$GITHUB_ENV" + rustc --version --verbose diff --git a/.github/workflows/_diskgraph-wheel.yml b/.github/workflows/_diskgraph-wheel.yml index 8e13f2ecf..84809c1ab 100644 --- a/.github/workflows/_diskgraph-wheel.yml +++ b/.github/workflows/_diskgraph-wheel.yml @@ -47,9 +47,7 @@ jobs: with: packages: lld - if: steps.cache.outputs.cache-hit != 'true' - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 - with: - toolchain: ${{ steps.settings.outputs.RUST_TOOLCHAIN }} + uses: ./.github/actions/rust-toolchain - if: steps.cache.outputs.cache-hit != 'true' uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 with: diff --git a/.github/workflows/kumo-engine-pr.yml b/.github/workflows/kumo-engine-pr.yml index 83130e1ab..00966c41a 100644 --- a/.github/workflows/kumo-engine-pr.yml +++ b/.github/workflows/kumo-engine-pr.yml @@ -92,9 +92,7 @@ jobs: - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 with: python-version: '3.12' - - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 - with: - toolchain: stable + - uses: ./.github/actions/rust-toolchain - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 with: workspaces: packages/diskgraph -> target diff --git a/.github/workflows/kumo-engine-wheel.yml b/.github/workflows/kumo-engine-wheel.yml index c9cce8444..21304d6df 100644 --- a/.github/workflows/kumo-engine-wheel.yml +++ b/.github/workflows/kumo-engine-wheel.yml @@ -105,11 +105,7 @@ jobs: python scripts/stamp_version.py --check - name: Set up Rust - # This org's Actions allowlist only permits dtolnay/rust-toolchain at - # @master or a pinned SHA, not @stable. - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master, allowlisted - with: - toolchain: stable + uses: ./.github/actions/rust-toolchain - name: Activate installed MSVC build tools if: ${{ runner.os == 'Windows' }} diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 6a2c61729..0c7aad847 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -368,10 +368,7 @@ jobs: timeout-minutes: 12 with: packages: lld - - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 - with: - # Pinned: a new stable clippy adds lints that fail unchanged code. - toolchain: 1.98.1 + - uses: ./.github/actions/rust-toolchain - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 with: python-version: '3.11' @@ -404,10 +401,8 @@ jobs: timeout-minutes: 12 with: packages: lld - - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 + - uses: ./.github/actions/rust-toolchain with: - # Pinned: a new stable clippy adds lints that fail unchanged code. - toolchain: 1.98.1 components: clippy - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 with: diff --git a/packages/diskgraph/diskgraph-core/src/dataset.rs b/packages/diskgraph/diskgraph-core/src/dataset.rs index 37ad8d210..c18dcc004 100644 --- a/packages/diskgraph/diskgraph-core/src/dataset.rs +++ b/packages/diskgraph/diskgraph-core/src/dataset.rs @@ -74,6 +74,8 @@ pub struct DatasetStatus { /// Contract for dataset lifecycle management. Implementations may keep their /// state purely in-memory or persist it on disk alongside the graph data. #[async_trait] +// async-trait's generated #[must_use]; fixed in clippy 1.100. +#[allow(clippy::double_must_use)] pub trait DatasetRegistry: Send + Sync { /// Insert or update a dataset handle. Typically invoked at the beginning of /// ingestion after parsing index_metadata.json. diff --git a/packages/diskgraph/diskgraph-core/src/storage.rs b/packages/diskgraph/diskgraph-core/src/storage.rs index 918defa4a..e1a1ce8b4 100644 --- a/packages/diskgraph/diskgraph-core/src/storage.rs +++ b/packages/diskgraph/diskgraph-core/src/storage.rs @@ -39,6 +39,8 @@ impl StorageConfig { /// Contract implemented by storage backends (local disk, remote cache, etc.). #[async_trait] +// async-trait's generated #[must_use]; fixed in clippy 1.100. +#[allow(clippy::double_must_use)] pub trait GraphStorage: Send + Sync { /// Reserve disk space for a dataset. Implementations must enforce the /// max_disk_fraction guard and fail fast if the reservation would exceed diff --git a/packages/diskgraph/rust-toolchain.toml b/packages/diskgraph/rust-toolchain.toml new file mode 100644 index 000000000..205db5884 --- /dev/null +++ b/packages/diskgraph/rust-toolchain.toml @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. +# All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Pinned: a new stable clippy adds lints that fail unchanged code. +[toolchain] +channel = "1.99.1" diff --git a/scripts/diskgraph b/scripts/diskgraph index 8ae56750e..b149f224c 100755 --- a/scripts/diskgraph +++ b/scripts/diskgraph @@ -171,19 +171,25 @@ PY } # CI wheel build settings; the wheel cache key covers them. -WHEEL_RUST_TOOLCHAIN=1.98.1 WHEEL_RUSTFLAGS='-C target-feature=+aes,+sse2 -C link-arg=-fuse-ld=lld -C debuginfo=line-tables-only' +wheel_rust_toolchain() { + sed -n 's/^channel = "\(.*\)"$/\1/p' "${DISKGRAPH_SOURCE}/rust-toolchain.toml" +} + cmd_wheel_env() { - printf 'RUST_TOOLCHAIN=%s\nRUSTFLAGS=%s\n' "$WHEEL_RUST_TOOLCHAIN" "$WHEEL_RUSTFLAGS" + local toolchain + toolchain="$(wheel_rust_toolchain)" + printf 'RUST_TOOLCHAIN=%s\nRUSTFLAGS=%s\n' "$toolchain" "$WHEEL_RUSTFLAGS" } cmd_wheel_key() { require_source - local tree settings + local tree settings toolchain tree="$(git -C "$REPO_ROOT" rev-parse HEAD:packages/diskgraph)" + toolchain="$(wheel_rust_toolchain)" settings="$(cmd_wheel_env | sha256sum | cut -c1-12)" - echo "diskgraph-wheel-v2-${RUNNER_OS:-$(uname -s)}-${RUNNER_ARCH:-$(uname -m)}-${tree}-rust${WHEEL_RUST_TOOLCHAIN}-${settings}" + echo "diskgraph-wheel-v2-${RUNNER_OS:-$(uname -s)}-${RUNNER_ARCH:-$(uname -m)}-${tree}-rust${toolchain}-${settings}" } command="${1:-}"