c2rust
c2rust copied to clipboard
`c2rust transpile` produces `gettimeofday` call with wrong argument type when reorganizing definitions
Steps to reproduce:
git clone https://github.com/ZirconiumX/Dorpsgekintercept-build makec2rust transpile --binary main --reorganize-definitions compile_commands.json
Expected result:
Code compiles cleanly
Actual result:
error[E0308]: mismatched types
--> time.rs:115:68
|
115 | ::libc::gettimeofday(&mut t as *mut _ as *mut ::libc::timeval, 0 as *mut libc::c_void);
| ^^^^^^^^^^^^^^^^^^^^^^ expected enum `libc::timezone`, found enum `libc::c_void`
|
= note: expected raw pointer `*mut libc::timezone`
found raw pointer `*mut libc::c_void`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
thread 'main' panicked at 'Could not rebuild crate: could not compile `c2rust_out`.
Something to note is that this translates fine without --reorganize-definitions.
This issue is also triggered when translating nginx with --reorganize-definitions enabled. I've temporarily disabled reorganize definitions in the c2rust-testsuite until this issue is resolved.