From 8751a5fe1d2c93b902eb637e517d421c5504f8bd Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Sat, 7 Mar 2026 16:34:23 -0800 Subject: [PATCH] ci: workaround RUSTFLAGS leaking into cargo-make/cargo-wdk rust-script builds Unset RUSTFLAGS for cargo-make and cargo-wdk steps in build.yaml to prevent -D warnings from leaking into rust-script compilation of wdk-build. This is a temporary workaround. The proper fix is in microsoft/windows-drivers-rs#629 which rewrites path deps to version-only deps in load_wdk_build_makefile() for registry consumers. Root cause: wdk-build = { path = '.' } in rust-driver-makefile.toml makes wdk-build a path dependency even when loaded from the registry cache via symlink. Cargo does not apply --cap-lints allow to path deps, so RUSTFLAGS leaks through. Tracked in ADO Bug #5396440. --- .github/workflows/build.yaml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e9437a1..d7576a9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -107,11 +107,27 @@ jobs: tool: cargo-make - name: Build and Package Sample Drivers - run: cargo make default +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} + # Unset RUSTFLAGS for cargo-make to work around RUSTFLAGS leaking into + # rust-script compilation of wdk-build (path dep via symlink defeats + # --cap-lints). Upstream fix: microsoft/windows-drivers-rs#629 + run: | + $env:RUSTFLAGS = $null + cargo make default +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} + shell: pwsh # Steps to use cargo-wdk to build and package drivers - name: Install cargo-wdk binary - run: cargo +${{ matrix.rust_toolchain }} install cargo-wdk --locked --force + # Unset RUSTFLAGS for cargo-wdk install to avoid same RUSTFLAGS leak + # as cargo-make. Upstream fix: microsoft/windows-drivers-rs#629 + run: | + $env:RUSTFLAGS = $null + cargo +${{ matrix.rust_toolchain }} install cargo-wdk --locked --force + shell: pwsh - name: Build and Package Sample Drivers with cargo-wdk - run: cargo +${{ matrix.rust_toolchain }} wdk build --sample --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }} + # Unset RUSTFLAGS for cargo-wdk to avoid same RUSTFLAGS leak + # as cargo-make. Upstream fix: microsoft/windows-drivers-rs#629 + run: | + $env:RUSTFLAGS = $null + cargo +${{ matrix.rust_toolchain }} wdk build --sample --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }} + shell: pwsh