git2-rs icon indicating copy to clipboard operation
git2-rs copied to clipboard

(Breaking Changes) Re-implement tracing wrapper in a safer way, replacing the use of `&str` with `&[u8]`.

Open vcfxb opened this issue 1 year ago • 0 comments

This changes the type signature of TracingCb to use a &[u8] over an &str, leaving the conversion to the consumer as planned. This is a breaking change and will require a new release.

Internally, this replaces the use of a static AtomicUsize to store the tracing subscriber with a AtomicPtr. This is still unsafe, but lets us avoid the integer to pointer transmutation that was previously happening which is more explicitly a possible violation of Rust's memory model. Now all the casts and transmutations in tracing.rs are between pointer types, which is (relatively) safer.

vcfxb avatar Jul 22 '24 19:07 vcfxb