Open rinon opened 5 years ago
How are structs handled? It seems like these should work the same way. A user of a C library is likely to have access to the typedefs of that C library via importing the C header. Similarly I would have expected a user of the translated Rust library to have access to just the same typedefs.
I might be missing something as I've been out of the c2rust mindset for a while, however!
Good point. This came up because we were discussing removing various casts and types (e.g. uint8_t
-> u8
), which would leave behind unused typedefs from standard headers. Removing the useless typedef in this case would be desirable, but if were pub
visibility this wouldn't be quite correct.
I think we'll have to think a bit more here about usability and expected behavior, since we have some latitude here. Just another data point to throw in, when we translate multiple binaries now, we build a central library with everything pub
visibility and each binary's translation unit has its own module that links against the library crate. This would be broken if we use pub(crate)
.
Since C can't export types, we should also not export typedefs from the translated crate.