Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vcfxb
Copy link
Contributor

@vcfxb vcfxb commented Jul 22, 2024

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.

…moke test, update tracing callback to use `&[u8]` instead of `&str`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant