Skip to content
New issue

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

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

Already on GitHub? # to your account

Change order of async and unsafe modifiers in instrument procmacro #2864

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

kaffarell
Copy link
Contributor

When using #[tracing::instrument] and the async unsafe modifiers the generated function read unsafe async fn, which is wrong. Corrected the order and added a test.

Fixes: #2576

When using `#[tracing::instrument]` and the `async unsafe` modifiers
the generated function read `unsafe async fn`, which is wrong. Corrected
the order and added a test.

Fixes: tokio-rs#2576

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
@kaffarell kaffarell requested review from hawkw and a team as code owners January 26, 2024 12:56
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for fixing this, and for adding a test!

@hawkw
Copy link
Member

hawkw commented Jan 26, 2024

warnings job failure is unrelated, let's fix that separately: https://github.com/tokio-rs/tracing/actions/runs/7668345432/job/20899985659#step:4:1

@hawkw hawkw merged commit 0e4a4be into tokio-rs:v0.1.x Jan 26, 2024
50 of 51 checks passed
kaffarell added a commit to kaffarell/tracing that referenced this pull request Feb 14, 2024
When using `#[tracing::instrument]` and the `async unsafe` modifiers
the generated function read `unsafe async fn`, which is wrong. Corrected
the order and added a test.

Fixes: tokio-rs#2576

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
@kaffarell
Copy link
Contributor Author

@hawkw had a look at the job failure and it seems like the private_in_public lint is now deprecated. They link to the RFC, which mentions that I has been split up in three other lints: private_interfaces, private_bounds and unnameable_types 1. The problem is that the third one (unnameable_types) is not stabilized yet 2 :/.
As the first two are currently warn-by-default we only have to add unnameable_types once it's stabilized.

Footnotes

  1. https://rust-lang.github.io/rfcs/2145-type-privacy.html

  2. https://github.com/rust-lang/rust/pull/120144

@kaffarell
Copy link
Contributor Author

I could already go ahead and add it so that we won't forget? It will only return a unknown_lint warning anyway...

@hawkw
Copy link
Member

hawkw commented Feb 16, 2024

Please do! Thank you!

@kaffarell
Copy link
Contributor Author

kaffarell commented Feb 19, 2024

Opened it: #2886!

kaffarell added a commit to kaffarell/tracing that referenced this pull request May 22, 2024
When using `#[tracing::instrument]` and the `async unsafe` modifiers
the generated function read `unsafe async fn`, which is wrong. Corrected
the order and added a test.

Fixes: tokio-rs#2576

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
davidbarsky pushed a commit that referenced this pull request Oct 2, 2024
When using `#[tracing::instrument]` and the `async unsafe` modifiers
the generated function read `unsafe async fn`, which is wrong. Corrected
the order and added a test.

Fixes: #2576

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
davidbarsky pushed a commit that referenced this pull request Oct 2, 2024
When using `#[tracing::instrument]` and the `async unsafe` modifiers
the generated function read `unsafe async fn`, which is wrong. Corrected
the order and added a test.

Fixes: #2576

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
davidbarsky pushed a commit that referenced this pull request Oct 2, 2024
When using `#[tracing::instrument]` and the `async unsafe` modifiers
the generated function read `unsafe async fn`, which is wrong. Corrected
the order and added a test.

Fixes: #2576

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
@hds hds mentioned this pull request Nov 19, 2024
20 tasks
hds added a commit that referenced this pull request Nov 25, 2024
# 0.1.28 (November 26, 2024)

### Changed

- Bump MSRV to 1.63 ([#2793])

### Fixed

- Added missing RecordTypes for instrument ([#2781])
- Change order of async and unsafe modifier ([#2864])
- Extract match scrutinee ([#2880])
- Allow field path segments to be keywords ([#2925])
- Support const values for `target` and `name` ([#2941])

### Documented

- Fix backporting error in attributes ([#2780])

[#2780]: #2780
[#2781]: #2781
[#2793]: #2793
[#2864]: #2864
[#2880]: #2880
[#2925]: #2925
[#2941]: #2941
hds added a commit that referenced this pull request Nov 26, 2024
# 0.1.28 (November 26, 2024)

### Changed

- Bump MSRV to 1.63 ([#2793])

### Fixed

- Added missing RecordTypes for instrument ([#2781])
- Change order of async and unsafe modifier ([#2864])
- Extract match scrutinee ([#2880])
- Allow field path segments to be keywords ([#2925])
- Support const values for `target` and `name` ([#2941])

### Documented

- Fix backporting error in attributes ([#2780])

[#2780]: #2780
[#2781]: #2781
[#2793]: #2793
[#2864]: #2864
[#2880]: #2880
[#2925]: #2925
[#2941]: #2941
hds added a commit that referenced this pull request Nov 27, 2024
# 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
hds added a commit that referenced this pull request Nov 27, 2024
# 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
hds added a commit that referenced this pull request Nov 27, 2024
# 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
hds added a commit that referenced this pull request Nov 27, 2024
# 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
hds added a commit that referenced this pull request Nov 27, 2024
# 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
hds added a commit that referenced this pull request Nov 27, 2024
# 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
hds added a commit that referenced this pull request Nov 27, 2024
# 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
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants