CI Clippy fails on a-publier: missing_transmute_annotations in victory-loader and victory-gpu #315

Closed
opened 2026-11-26 19:59:05 +00:00 by github-bot · 2 comments
Owner

@⁠itsonewi on GitHub · 2026-11-26 19:53 UTC · original

Summary

cargo clippy --workspace --all-targets --locked -- -D warnings fails on the default branch (a-publier, head cd8dfc0) with clippy::missing_transmute_annotations (warn-by-default, promoted to an error by -D warnings). Rust is 1.98.1 from rust-toolchain.toml.

Evidence

Both failing runs are on branches whose diff against cd8dfc0 does not touch the failing files:

  • Run 45881316393 (PR #289, head 1d10722; only .github/workflows/ci.yml changed): Clippy job failed.
  • Run 45883850319 (PR #297, head 1be739a; only crates/victory-hle/src/modules/xmem.rs changed): Clippy job failed with the same diagnostics.

Log excerpt from the Clippy job:

error: transmute used without annotations
   --> crates\victory-loader\src\descriptor_sites.rs:277:58
    |
277 |                 let (plain, hooked): (F, F) = (std::mem::transmute(plain), std::mem::transmute(hooked));
    |                                                          ^^^^^^^^^^ help: consider adding missing annotations: `transmute::<usize, unsafe extern "system" fn(u64, *mut u8, *const u8, *mut u8) -> u64>`

error: transmute used without annotations
   --> crates\victory-loader\src\descriptor_sites.rs:277:86
    |
277 |                 let (plain, hooked): (F, F) = (std::mem::transmute(plain), std::mem::transmute(hooked));
    |                                                                                      ^^^^^^^^^^ help: consider adding missing annotations: `transmute::<usize, unsafe extern "system" fn(u64, *mut u8, *const u8, *mut u8) -> u64>`

error: transmute used without annotations
   --> crates\victory-gpu\src\host\panel.rs:386:28
    |
386 |             Some(std::mem::transmute::<_, NtQuery>(p))
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider adding missing annotations: `transmute::<unsafe extern "system" fn() -> isize, unsafe extern "system" fn(u32, *mut u8, u32, *mut u32) -> i32>`

Code

crates/victory-loader/src/descriptor_sites.rs:261,277:

type F = unsafe extern "system" fn(u64, *mut u8, *const u8, *mut u8) -> u64;
...
let (plain, hooked): (F, F) = (std::mem::transmute(plain), std::mem::transmute(hooked));

The (F, F) annotation on the binding is not enough: Clippy wants the source and destination types on each transmute call.

crates/victory-gpu/src/host/panel.rs:378,386:

type NtQuery = unsafe extern "system" fn(u32, *mut u8, u32, *mut u32) -> i32;
...
Some(std::mem::transmute::<_, NtQuery>(p))

Here the destination is annotated but the source is _.

Suggested fix

Use explicit types:

let (plain, hooked): (F, F) = (
    std::mem::transmute::<usize, F>(plain),
    std::mem::transmute::<usize, F>(hooked),
);
Some(std::mem::transmute::<unsafe extern "system" fn() -> isize, NtQuery>(p))

Alternatively, add #[allow(clippy::missing_transmute_annotations)] at the two call sites with a short reason, but the explicit annotations are small and keep the lint active elsewhere.

Note: crates/victory-loader/src/descriptor_sites.rs is inside a test module (the test builds executable memory and calls it), but --all-targets lints tests too.

Environment

  • windows-latest, Rust 1.98.1
  • cargo clippy --workspace --all-targets --locked -- -D warnings
**@⁠itsonewi** on GitHub · 2026-11-26 19:53 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/315) ## Summary `cargo clippy --workspace --all-targets --locked -- -D warnings` fails on the default branch (`a-publier`, head `cd8dfc0`) with `clippy::missing_transmute_annotations` (warn-by-default, promoted to an error by `-D warnings`). Rust is 1.98.1 from `rust-toolchain.toml`. ## Evidence Both failing runs are on branches whose diff against `cd8dfc0` does not touch the failing files: - Run [45881316393](https://github.com/Belobug/VIctory-Belobug-AMD/actions/runs/45881316393) (PR #289, head `1d10722`; only `.github/workflows/ci.yml` changed): Clippy job failed. - Run [45883850319](https://github.com/Belobug/VIctory-Belobug-AMD/actions/runs/45883850319) (PR #297, head `1be739a`; only `crates/victory-hle/src/modules/xmem.rs` changed): Clippy job failed with the same diagnostics. Log excerpt from the Clippy job: ``` error: transmute used without annotations --> crates\victory-loader\src\descriptor_sites.rs:277:58 | 277 | let (plain, hooked): (F, F) = (std::mem::transmute(plain), std::mem::transmute(hooked)); | ^^^^^^^^^^ help: consider adding missing annotations: `transmute::<usize, unsafe extern "system" fn(u64, *mut u8, *const u8, *mut u8) -> u64>` error: transmute used without annotations --> crates\victory-loader\src\descriptor_sites.rs:277:86 | 277 | let (plain, hooked): (F, F) = (std::mem::transmute(plain), std::mem::transmute(hooked)); | ^^^^^^^^^^ help: consider adding missing annotations: `transmute::<usize, unsafe extern "system" fn(u64, *mut u8, *const u8, *mut u8) -> u64>` error: transmute used without annotations --> crates\victory-gpu\src\host\panel.rs:386:28 | 386 | Some(std::mem::transmute::<_, NtQuery>(p)) | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider adding missing annotations: `transmute::<unsafe extern "system" fn() -> isize, unsafe extern "system" fn(u32, *mut u8, u32, *mut u32) -> i32>` ``` ## Code `crates/victory-loader/src/descriptor_sites.rs:261,277`: ```rust type F = unsafe extern "system" fn(u64, *mut u8, *const u8, *mut u8) -> u64; ... let (plain, hooked): (F, F) = (std::mem::transmute(plain), std::mem::transmute(hooked)); ``` The `(F, F)` annotation on the binding is not enough: Clippy wants the source and destination types on each `transmute` call. `crates/victory-gpu/src/host/panel.rs:378,386`: ```rust type NtQuery = unsafe extern "system" fn(u32, *mut u8, u32, *mut u32) -> i32; ... Some(std::mem::transmute::<_, NtQuery>(p)) ``` Here the destination is annotated but the source is `_`. ## Suggested fix Use explicit types: ```rust let (plain, hooked): (F, F) = ( std::mem::transmute::<usize, F>(plain), std::mem::transmute::<usize, F>(hooked), ); ``` ```rust Some(std::mem::transmute::<unsafe extern "system" fn() -> isize, NtQuery>(p)) ``` Alternatively, add `#[allow(clippy::missing_transmute_annotations)]` at the two call sites with a short reason, but the explicit annotations are small and keep the lint active elsewhere. Note: `crates/victory-loader/src/descriptor_sites.rs` is inside a test module (the test builds executable memory and calls it), but `--all-targets` lints tests too. ## Environment - `windows-latest`, Rust 1.98.1 - `cargo clippy --workspace --all-targets --locked -- -D warnings`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:59:05 +00:00
Author
Owner

@⁠BE29ZZ on GitHub · 2026-11-26 19:55 UTC · original

ok, trabalharei nisso para te ajudar

**@⁠BE29ZZ** on GitHub · 2026-11-26 19:55 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/315#issuecomment-7202111366) ok, trabalharei nisso para te ajudar
Author
Owner

@⁠BE29ZZ on GitHub · 2026-11-26 20:35 UTC · original

Opened #330 with the fix for this issue.

In addition to adding the missing std::mem::transmute type annotations in crates/victory-loader/src/descriptor_sites.rs and crates/victory-gpu/src/host/panel.rs, it also resolves two remaining Clippy warnings on a-publier (crates/victory-gpu/src/watch.rs:3626 unnecessary &mut and crates/victory-gpu/src/texture.rs:46 unused diagnostics-only field) so both cargo clippy --workspace --all-targets --locked -- -D warnings and the --all-features pass succeed cleanly (verified locally on Windows x64 with Rust 1.98.1).

**@⁠BE29ZZ** on GitHub · 2026-11-26 20:35 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/315#issuecomment-7202858772) Opened #330 with the fix for this issue. In addition to adding the missing `std::mem::transmute` type annotations in `crates/victory-loader/src/descriptor_sites.rs` and `crates/victory-gpu/src/host/panel.rs`, it also resolves two remaining Clippy warnings on `a-publier` (`crates/victory-gpu/src/watch.rs:3626` unnecessary `&mut` and `crates/victory-gpu/src/texture.rs:46` unused `diagnostics`-only field) so both `cargo clippy --workspace --all-targets --locked -- -D warnings` and the `--all-features` pass succeed cleanly (verified locally on Windows x64 with Rust 1.98.1).
This discussion has been locked. Commenting is limited to contributors.
No description provided.