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

Closed
opened 2026-11-26 19:53:35 +00:00 by itsonewi · 2 comments
itsonewi commented 2026-11-26 19:53:35 +00:00 (Migrated from github.com)
Contributor

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by itsonewi on 2026-11-26T19:53:35Z.


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
<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:6634099524 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/issues/315). Originally posted by [itsonewi](https://github.com/itsonewi) on 2026-11-26T19:53:35Z. --- ## 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`
BE29ZZ commented 2026-11-26 19:55:46 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by BE29ZZ on 2026-11-26T19:55:46Z.


ok, trabalharei nisso para te ajudar

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7202111366 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/issues/315#issuecomment-7202111366). Originally posted by [BE29ZZ](https://github.com/BE29ZZ) on 2026-11-26T19:55:46Z. --- ok, trabalharei nisso para te ajudar
BE29ZZ commented 2026-11-26 20:35:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by BE29ZZ on 2026-11-26T20:35:15Z.


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).

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7202858772 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/issues/315#issuecomment-7202858772). Originally posted by [BE29ZZ](https://github.com/BE29ZZ) on 2026-11-26T20:35:15Z. --- 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).
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Belobug/VIctory-Belobug-AMD#315
No description provided.