Skip to content

c2rust transpile produces gettimeofday call with wrong argument type when reorganizing definitions #266

@Ravenslofty

Description

@Ravenslofty

Steps to reproduce:

  • git clone https://github.com/ZirconiumX/Dorpsgek
  • intercept-build make
  • c2rust 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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingrefactorerThis issue relates to the refactoring tool

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions