rust-lang / git2-rs

libgit2 bindings for Rust
https://docs.rs/git2
Apache License 2.0
1.64k stars 380 forks source link

Don't pretend that TreeWalkCbData is transparent. #989

Closed ehuss closed 9 months ago

ehuss commented 9 months ago

This is doing some pointer casts that make the assumption that TreeWalkCbData is transparent, when it is not declared as such. Although this is unlikely to be an issue in practice, it breaks the rules about repr(rust) type layout. This reworks it to avoid that assumption. I think it could potentially be repr(transparent), but I'm not sure that is really necessary. There's probably a better way to avoid the wrapper, but I'm not inclined to try to find it.