Skip to content

Authored by Claude (Opus 4.8): Fix function-item-cast-to-integer warn… - #87

Merged
jmquigs merged 1 commit into
masterfrom
claude/function-pointer-cast-warnings-qshi2v
Jul 11, 2026
Merged

Authored by Claude (Opus 4.8): Fix function-item-cast-to-integer warn…#87
jmquigs merged 1 commit into
masterfrom
claude/function-pointer-cast-warnings-qshi2v

Conversation

@jmquigs

@jmquigs jmquigs commented Jul 11, 2026

Copy link
Copy Markdown
Owner

…ings

A recent rustc change added the function_casts_as_integer lint, which warns when a named function item is cast directly to an integer. The d3d9/d3d11 hooking code does this to compare addresses (detecting whether a vtable slot already points at our hook function to avoid double-hooking).

Route the function-item operand through a pointer first (hook_fn as *const () as usize), as suggested by the compiler. The numeric address is identical, so all the "already hooked?" comparisons behave exactly as before. Only the function-item operands are changed; the function-pointer operands (vtable fields / stored real fn pointers) do not trigger the lint and are left untouched.

Claude-Session: https://claude.ai/code/session_01HRC7uez7K5jPzx7Kyp5g8j

…ings

A recent rustc change added the `function_casts_as_integer` lint, which
warns when a named function item is cast directly to an integer. The
d3d9/d3d11 hooking code does this to compare addresses (detecting whether
a vtable slot already points at our hook function to avoid double-hooking).

Route the function-item operand through a pointer first
(`hook_fn as *const () as usize`), as suggested by the compiler. The
numeric address is identical, so all the "already hooked?" comparisons
behave exactly as before. Only the function-item operands are changed;
the function-pointer operands (vtable fields / stored real fn pointers)
do not trigger the lint and are left untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HRC7uez7K5jPzx7Kyp5g8j
@jmquigs
jmquigs merged commit 7182c44 into master Jul 11, 2026
1 check passed
@jmquigs
jmquigs deleted the claude/function-pointer-cast-warnings-qshi2v branch July 11, 2026 16:57
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.

2 participants