You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ctest: Figure out a way to test private items #4649
We have some definitions that aren't crate-public but come from C, so we should probably test them. One idea about how to do this is to just paste private items into the output file, since we have the AST version available.
Would it be possible to just walk the entire crate and make everything public by modifying the AST, then just testing the new version? Kind of like what src-hotfix does right now by replacing the ::.
Or if we only want to test private items separately then a simple inversion, to make private items public and public items private, and for private fields making sure the item remains public as well as marking the field public.
Sure, that would work too as long as the glob imports were removed (since private items within modules may have the same name). It would be nice to only copy the items we need rather than the entire source, though.
Activity
mbyx commentedon Aug 13, 2025
Would it be possible to just walk the entire crate and make everything public by modifying the AST, then just testing the new version? Kind of like what
src-hotfixdoes right now by replacing the::.Or if we only want to test private items separately then a simple inversion, to make private items public and public items private, and for private fields making sure the item remains public as well as marking the field public.
tgross35 commentedon Aug 13, 2025
Sure, that would work too as long as the glob imports were removed (since private items within modules may have the same name). It would be nice to only copy the items we need rather than the entire source, though.
xtqqczze commentedon Sep 16, 2026
The quick-and-dirty approach would be to make all of the private fields
pub(crate). This is whatrustixdoes, for example.tgross35 commentedon Sep 16, 2026
I'd be fine with that visibility change but does that help us? libc-test is a separate crate.
We could probably make it
include!or#[path = "..."]but I assume that would come with other issues.