Skip to content

GPU: keep clippy green without the diagnostics feature - #491

Open
iloveslopware wants to merge 1 commit into
fxceless:mainfrom
iloveslopware:main-clippy-diagnostics
Open

iloveslopware wants to merge 1 commit into
fxceless:mainfrom
iloveslopware:main-clippy-diagnostics

Conversation

@iloveslopware

Copy link
Copy Markdown

main's CI has been red since c96b4f2 (run 45525228245): the default-features clippy lane fails with

error: function `placed_filler_twins` is never used
   --> crates\victory-gpu\src\resource.rs:2053

The getter's only caller is the memory line in copystat, and that module compiles only under all(windows, feature = "diagnostics") — with default features there is no caller, and -D dead_code fails the build. The --all-features lane stays green, which is why only one lane went red.

The fix is the attribute this crate already uses for diagnostics-only items (shadow.rs:2962, pipeline.rs:86, pipeline/host.rs:323):

#[cfg(windows)]
#[cfg_attr(not(feature = "diagnostics"), allow(dead_code))]
pub(crate) fn placed_filler_twins() -> u64 {

Nothing else changes: --all-features behavior is identical, and the getter is still there for the diagnostics line.

Verification (cross-checked from Linux with clang-cl 23.1.5, the same command CI runs):

  • cargo clippy --target x86_64-pc-windows-msvc --workspace --all-targets --locked -- -D warnings — failed before with the error above, clean after;
  • the same with --all-features — clean before and after;
  • at this base victory-gpu does not compile on non-Windows targets — pre-existing since c96b4f2, unrelated to this attribute, and the subject of Linux: finish the non-Windows build and tests #449.

Disclosure: written with AI assistance (GLM via OpenCode) — the diagnosis follows the public CI log, and the fix and cross-verification were drafted and run with the tool. Reviewed and understood by the human submitting it.

@avt0m4t48

Copy link
Copy Markdown

I independently checked this with the pinned Rust 1.98.1 toolchain, cross-targeting x86_64-pc-windows-msvc from Linux. The base c96b4f2b8365bf43d54ab074940923ef8267f4c6 failed on placed_filler_twins with -D dead-code. The PR head d28e0ddd1e142263b971a39323164ade3615303d passed workspace Clippy for all targets with warnings denied, both with the project's default features and with --all-features.

I used --features blake3/pure in both revisions to run the cross-check without Microsoft's ml64.exe. The source trees were unmodified. This covers the Windows-target lint regression. Native Windows CI and runtime tests were outside this check.

cargo clippy --workspace --all-targets --target x86_64-pc-windows-msvc --locked --features blake3/pure -- -D warnings
cargo clippy --workspace --all-targets --target x86_64-pc-windows-msvc --locked --features blake3/pure --all-features -- -D warnings

@iloveslopware

Copy link
Copy Markdown
Author

Thanks for the independent check — and for writing down the blake3/pure route to a cross-target lint run without ml64.exe; that's a tidier recipe than the CC/AR clang-cl/llvm-ar overrides I used, for anyone without LLVM on PATH.

Scope note for the record: the PR is gating-only — #[cfg_attr(not(feature = "diagnostics"), allow(dead_code))] on placed_filler_twins, the same pattern copystat already uses; no behavior change on any target or feature set. Native CI still needs maintainer approval to run, as you say.

AI-assisted (GLM via OpenCode).

@JRamos1993

Copy link
Copy Markdown

On current main (9376fd6) this patch still merges and fixes placed_filler_twins, but CI's clippy now fails on two newer lints as well (sort_unstable_by_key in draw.rs, depth_written never read in indirect.rs), with and without --all-features. #642, #755 and #841 fix all three. Comparison: #642 (comment)

c96b4f2 added placed_filler_twins for the memory line in copystat,
which compiles only on Windows with diagnostics on, so the default-
features clippy lane (the CI gate on main) sees no caller and fails
with -D dead_code. Mark it allowed-dead without the feature, the same
attribute shadow.rs, pipeline.rs and pipeline/host.rs already use for
diagnostics-only items.
@iloveslopware
iloveslopware force-pushed the main-clippy-diagnostics branch from d28e0dd to 577917f Compare November 25, 2026 19:21
@iloveslopware

Copy link
Copy Markdown
Author

Rebased onto current main (d510ee4) — thanks @JRamos1993 for the check. Re-verified against the new base:

AI-assisted: the verification runs and this analysis were machine-assisted; the change and its rationale are as described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants