-
Notifications
You must be signed in to change notification settings - Fork 732
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
tracing: removed core imports in macros #2762
Conversation
When a user has a crate named `core`, it can cause issues because our crates import from `::core::*`. Now we are importing from `$crate::__macro_support::*` and there will be no more name clashes. Fixes: tokio-rs#2761
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for the PR, this looks good to me!
one question i have is whether it would be possible to add a regression test for this that would fail to compile with the previous code. i imagine this would have to be in a separate crate, rather than part of the regular integration tests. if this is too much work, don't worry about it, but it would be nice to have.
I think I'd have to create a new crate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make sure to document why we now re-export these names from core
. Once that's done, I'll be happy to merge this --- thank you!
Added explanation to why we re-export core functions in `tracing/src/lib.rs`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, thank you!
When a user has a crate named `core`, it can cause issues because our crates import from `::core::*`. Now we are importing from `$crate::__macro_support::*` and there will be no more name clashes.
When a user has a crate named `core`, it can cause issues because our crates import from `::core::*`. Now we are importing from `$crate::__macro_support::*` and there will be no more name clashes.
When a user has a crate named `core`, it can cause issues because our crates import from `::core::*`. Now we are importing from `$crate::__macro_support::*` and there will be no more name clashes.
When a user has a crate named `core`, it can cause issues because our crates import from `::core::*`. Now we are importing from `$crate::__macro_support::*` and there will be no more name clashes.
This ensures that the tracing lib correctly builds when a crate is named `core`. See tokio-rs#2761 and tokio-rs#2762 for more info.
# 0.1.41 (November 25, 2024) [[[crates.io][crate-0.1.41]]] | [[[docs.rs][docs-0.1.41]]] This release updates the `tracing-core` dependency to [v0.1.33][core-0.1.33] and the `tracing-attributes` dependency to [v0.1.28][attrs-0.1.28]. ### Added - **core**: Add index API for `Field` ([#2820]) - **core**: Allow `&[u8]` to be recorded as event/span field ([#2954]) ### Changed - Bump MSRV to 1.63 ([#2793]) - **core**: Use const `thread_local`s when possible ([#2838]) ### Fixed - Removed core imports in macros ([#2762]) - **attributes**: Added missing RecordTypes for instrument ([#2781]) - **attributes**: Change order of async and unsafe modifier ([#2864]) - Fix missing field prefixes ([#2878]) - **attributes**: Extract match scrutinee ([#2880]) - Fix non-simple macro usage without message ([#2879]) - Fix event macros with constant field names in the first position ([#2883]) - Allow field path segments to be keywords ([#2925]) - **core**: Fix missed `register_callsite` error ([#2938]) - **attributes**: Support const values for `target` and `name` ([#2941]) - Prefix macro calls with ::core to avoid clashing with local macros ([#3024]) [#2762]: #2762 [#2781]: #2781 [#2793]: #2793 [#2820]: #2820 [#2838]: #2838 [#2864]: #2864 [#2878]: #2878 [#2879]: #2879 [#2880]: #2880 [#2883]: #2883 [#2925]: #2925 [#2938]: #2938 [#2941]: #2941 [#2954]: #2954 [#3024]: #3024 [attrs-0.1.28]: https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.28 [core-0.1.33]: https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.33 [docs-0.1.41]: https://docs.rs/tracing/0.1.41/tracing/ [crate-0.1.41]: https://crates.io/crates/tracing/0.1.41
# 0.1.41 (November 25, 2024) [[[crates.io][crate-0.1.41]]] | [[[docs.rs][docs-0.1.41]]] This release updates the `tracing-core` dependency to [v0.1.33][core-0.1.33] and the `tracing-attributes` dependency to [v0.1.28][attrs-0.1.28]. ### Added - **core**: Add index API for `Field` ([#2820]) - **core**: Allow `&[u8]` to be recorded as event/span field ([#2954]) ### Changed - Bump MSRV to 1.63 ([#2793]) - **core**: Use const `thread_local`s when possible ([#2838]) ### Fixed - Removed core imports in macros ([#2762]) - **attributes**: Added missing RecordTypes for instrument ([#2781]) - **attributes**: Change order of async and unsafe modifier ([#2864]) - Fix missing field prefixes ([#2878]) - **attributes**: Extract match scrutinee ([#2880]) - Fix non-simple macro usage without message ([#2879]) - Fix event macros with constant field names in the first position ([#2883]) - Allow field path segments to be keywords ([#2925]) - **core**: Fix missed `register_callsite` error ([#2938]) - **attributes**: Support const values for `target` and `name` ([#2941]) - Prefix macro calls with ::core to avoid clashing with local macros ([#3024]) [#2762]: #2762 [#2781]: #2781 [#2793]: #2793 [#2820]: #2820 [#2838]: #2838 [#2864]: #2864 [#2878]: #2878 [#2879]: #2879 [#2880]: #2880 [#2883]: #2883 [#2925]: #2925 [#2938]: #2938 [#2941]: #2941 [#2954]: #2954 [#3024]: #3024 [attrs-0.1.28]: https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.28 [core-0.1.33]: https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.33 [docs-0.1.41]: https://docs.rs/tracing/0.1.41/tracing/ [crate-0.1.41]: https://crates.io/crates/tracing/0.1.41
# 0.1.41 (November 25, 2024) [[[crates.io][crate-0.1.41]]] | [[[docs.rs][docs-0.1.41]]] This release updates the `tracing-core` dependency to [v0.1.33][core-0.1.33] and the `tracing-attributes` dependency to [v0.1.28][attrs-0.1.28]. ### Added - **core**: Add index API for `Field` ([#2820]) - **core**: Allow `&[u8]` to be recorded as event/span field ([#2954]) ### Changed - Bump MSRV to 1.63 ([#2793]) - **core**: Use const `thread_local`s when possible ([#2838]) ### Fixed - Removed core imports in macros ([#2762]) - **attributes**: Added missing RecordTypes for instrument ([#2781]) - **attributes**: Change order of async and unsafe modifier ([#2864]) - Fix missing field prefixes ([#2878]) - **attributes**: Extract match scrutinee ([#2880]) - Fix non-simple macro usage without message ([#2879]) - Fix event macros with constant field names in the first position ([#2883]) - Allow field path segments to be keywords ([#2925]) - **core**: Fix missed `register_callsite` error ([#2938]) - **attributes**: Support const values for `target` and `name` ([#2941]) - Prefix macro calls with ::core to avoid clashing with local macros ([#3024]) [#2762]: #2762 [#2781]: #2781 [#2793]: #2793 [#2820]: #2820 [#2838]: #2838 [#2864]: #2864 [#2878]: #2878 [#2879]: #2879 [#2880]: #2880 [#2883]: #2883 [#2925]: #2925 [#2938]: #2938 [#2941]: #2941 [#2954]: #2954 [#3024]: #3024 [attrs-0.1.28]: https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.28 [core-0.1.33]: https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.33 [docs-0.1.41]: https://docs.rs/tracing/0.1.41/tracing/ [crate-0.1.41]: https://crates.io/crates/tracing/0.1.41
# 0.1.41 (November 25, 2024) [ [crates.io][crate-0.1.41] ] | [ [docs.rs][docs-0.1.41] ] This release updates the `tracing-core` dependency to [v0.1.33][core-0.1.33] and the `tracing-attributes` dependency to [v0.1.28][attrs-0.1.28]. ### Added - **core**: Add index API for `Field` ([#2820]) - **core**: Allow `&[u8]` to be recorded as event/span field ([#2954]) ### Changed - Bump MSRV to 1.63 ([#2793]) - **core**: Use const `thread_local`s when possible ([#2838]) ### Fixed - Removed core imports in macros ([#2762]) - **attributes**: Added missing RecordTypes for instrument ([#2781]) - **attributes**: Change order of async and unsafe modifier ([#2864]) - Fix missing field prefixes ([#2878]) - **attributes**: Extract match scrutinee ([#2880]) - Fix non-simple macro usage without message ([#2879]) - Fix event macros with constant field names in the first position ([#2883]) - Allow field path segments to be keywords ([#2925]) - **core**: Fix missed `register_callsite` error ([#2938]) - **attributes**: Support const values for `target` and `name` ([#2941]) - Prefix macro calls with ::core to avoid clashing with local macros ([#3024]) [#2762]: #2762 [#2781]: #2781 [#2793]: #2793 [#2820]: #2820 [#2838]: #2838 [#2864]: #2864 [#2878]: #2878 [#2879]: #2879 [#2880]: #2880 [#2883]: #2883 [#2925]: #2925 [#2938]: #2938 [#2941]: #2941 [#2954]: #2954 [#3024]: #3024 [attrs-0.1.28]: https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.28 [core-0.1.33]: https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.33 [docs-0.1.41]: https://docs.rs/tracing/0.1.41/tracing/ [crate-0.1.41]: https://crates.io/crates/tracing/0.1.41
# 0.1.41 (November 25, 2024) [ [crates.io][crate-0.1.41] ] | [ [docs.rs][docs-0.1.41] ] This release updates the `tracing-core` dependency to [v0.1.33][core-0.1.33] and the `tracing-attributes` dependency to [v0.1.28][attrs-0.1.28]. ### Added - **core**: Add index API for `Field` ([#2820]) - **core**: Allow `&[u8]` to be recorded as event/span field ([#2954]) ### Changed - Bump MSRV to 1.63 ([#2793]) - **core**: Use const `thread_local`s when possible ([#2838]) ### Fixed - Removed core imports in macros ([#2762]) - **attributes**: Added missing RecordTypes for instrument ([#2781]) - **attributes**: Change order of async and unsafe modifier ([#2864]) - Fix missing field prefixes ([#2878]) - **attributes**: Extract match scrutinee ([#2880]) - Fix non-simple macro usage without message ([#2879]) - Fix event macros with constant field names in the first position ([#2883]) - Allow field path segments to be keywords ([#2925]) - **core**: Fix missed `register_callsite` error ([#2938]) - **attributes**: Support const values for `target` and `name` ([#2941]) - Prefix macro calls with ::core to avoid clashing with local macros ([#3024]) [#2762]: #2762 [#2781]: #2781 [#2793]: #2793 [#2820]: #2820 [#2838]: #2838 [#2864]: #2864 [#2878]: #2878 [#2879]: #2879 [#2880]: #2880 [#2883]: #2883 [#2925]: #2925 [#2938]: #2938 [#2941]: #2941 [#2954]: #2954 [#3024]: #3024 [attrs-0.1.28]: https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.28 [core-0.1.33]: https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.33 [docs-0.1.41]: https://docs.rs/tracing/0.1.41/tracing/ [crate-0.1.41]: https://crates.io/crates/tracing/0.1.41
# 0.1.41 (November 27, 2024) [ [crates.io][crate-0.1.41] ] | [ [docs.rs][docs-0.1.41] ] This release updates the `tracing-core` dependency to [v0.1.33][core-0.1.33] and the `tracing-attributes` dependency to [v0.1.28][attrs-0.1.28]. ### Added - **core**: Add index API for `Field` ([#2820]) - **core**: Allow `&[u8]` to be recorded as event/span field ([#2954]) ### Changed - Bump MSRV to 1.63 ([#2793]) - **core**: Use const `thread_local`s when possible ([#2838]) ### Fixed - Removed core imports in macros ([#2762]) - **attributes**: Added missing RecordTypes for instrument ([#2781]) - **attributes**: Change order of async and unsafe modifier ([#2864]) - Fix missing field prefixes ([#2878]) - **attributes**: Extract match scrutinee ([#2880]) - Fix non-simple macro usage without message ([#2879]) - Fix event macros with constant field names in the first position ([#2883]) - Allow field path segments to be keywords ([#2925]) - **core**: Fix missed `register_callsite` error ([#2938]) - **attributes**: Support const values for `target` and `name` ([#2941]) - Prefix macro calls with ::core to avoid clashing with local macros ([#3024]) [#2762]: #2762 [#2781]: #2781 [#2793]: #2793 [#2820]: #2820 [#2838]: #2838 [#2864]: #2864 [#2878]: #2878 [#2879]: #2879 [#2880]: #2880 [#2883]: #2883 [#2925]: #2925 [#2938]: #2938 [#2941]: #2941 [#2954]: #2954 [#3024]: #3024 [attrs-0.1.28]: https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.28 [core-0.1.33]: https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.33 [docs-0.1.41]: https://docs.rs/tracing/0.1.41/tracing/ [crate-0.1.41]: https://crates.io/crates/tracing/0.1.41
# 0.1.41 (November 27, 2024) [ [crates.io][crate-0.1.41] ] | [ [docs.rs][docs-0.1.41] ] This release updates the `tracing-core` dependency to [v0.1.33][core-0.1.33] and the `tracing-attributes` dependency to [v0.1.28][attrs-0.1.28]. ### Added - **core**: Add index API for `Field` ([#2820]) - **core**: Allow `&[u8]` to be recorded as event/span field ([#2954]) ### Changed - Bump MSRV to 1.63 ([#2793]) - **core**: Use const `thread_local`s when possible ([#2838]) ### Fixed - Removed core imports in macros ([#2762]) - **attributes**: Added missing RecordTypes for instrument ([#2781]) - **attributes**: Change order of async and unsafe modifier ([#2864]) - Fix missing field prefixes ([#2878]) - **attributes**: Extract match scrutinee ([#2880]) - Fix non-simple macro usage without message ([#2879]) - Fix event macros with constant field names in the first position ([#2883]) - Allow field path segments to be keywords ([#2925]) - **core**: Fix missed `register_callsite` error ([#2938]) - **attributes**: Support const values for `target` and `name` ([#2941]) - Prefix macro calls with ::core to avoid clashing with local macros ([#3024]) [#2762]: #2762 [#2781]: #2781 [#2793]: #2793 [#2820]: #2820 [#2838]: #2838 [#2864]: #2864 [#2878]: #2878 [#2879]: #2879 [#2880]: #2880 [#2883]: #2883 [#2925]: #2925 [#2938]: #2938 [#2941]: #2941 [#2954]: #2954 [#3024]: #3024 [attrs-0.1.28]: https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.28 [core-0.1.33]: https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.33 [docs-0.1.41]: https://docs.rs/tracing/0.1.41/tracing/ [crate-0.1.41]: https://crates.io/crates/tracing/0.1.41
When a user has a crate named
core
, it can cause issues because our crates import from::core::*
. Now we are importing from$crate::__macro_support::*
and there won't be any name clashes anymore.Fixes: #2761