Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should the type of function_pointer in GuestFunctionDefinition be changed from i64 #216

Open
simongdavies opened this issue Jan 30, 2025 · 1 comment

Comments

@simongdavies
Copy link
Contributor

The field function_pointer in struct GuestFunctionDefinition is defined as a i64.

This requires that a function pointer passed to register_function is cast to i64

When running clippy on a guest that casts from a func directly to i64 (e.g. myfunc as i64) results in the clippy error "casting function pointer myfunc to i64" and the suggested fix "try: myfunc as usize" which does not work.

The options are to disable the clippy check ([allow(clippy::fn_to_numeric_cast)]) or to double cast the pointer (e.g. myfunc as *const() as i64 or myfunc as usize as i64).

Should the definition of the field function pointer be changed to either usize or fn(&FunctionCall) -> Result<Vec<u8>>

@syntactically
Copy link
Contributor

Hopefully we'll get rid of GuestFunctionDefinition entirely soon :)

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

No branches or pull requests

2 participants