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

Remove dep cfg-if from tracing #2553

Merged
merged 1 commit into from Apr 12, 2023
Merged

Remove dep cfg-if from tracing #2553

merged 1 commit into from Apr 12, 2023

Conversation

NobodyXu
Copy link
Contributor

@NobodyXu NobodyXu commented Apr 11, 2023

Motivation

Same reason as rust-lang/log#536 :

cfg_if is only used in a single place and tracing is used by many other crates, so even removing one dependency will be beneficial.

Solution

Remove dependency cfg-if and replace cfg_if::cfg_if! with a const fn get_max_level_inner() -> LevelFilter and uses if cfg!(...) inside.

Using if in const function is stablised in 1.46 so this should work fine in msrv 1.56

@NobodyXu NobodyXu requested review from hawkw, davidbarsky and a team as code owners April 11, 2023 09:43
Same reason as rust-lang/log#536 :

`cfg_if` is only used in a single place and `tracing` is used by many
other crates, so even removing one dependency will be beneficial.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
@hawkw hawkw merged commit 5722b45 into tokio-rs:master Apr 12, 2023
56 checks passed
@NobodyXu NobodyXu deleted the remove-cfg-if branch April 13, 2023 03:17
hawkw pushed a commit that referenced this pull request Apr 21, 2023
Same reason as rust-lang/log#536 :

`cfg_if` is only used in a single place and `tracing` is used by many
other crates, so even removing one dependency will be beneficial.

Remove dependency `cfg-if` and replace `cfg_if::cfg_if!` with a `const
fn get_max_level_inner() -> LevelFilter` and uses `if cfg!(...)` inside.

Using if in const function is stablised in
[1.46](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1460-2020-08-27)
so this should work fine in msrv 1.56

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
; Conflicts:
;	tracing/Cargo.toml
;	tracing/src/level_filters.rs
hawkw pushed a commit that referenced this pull request Apr 21, 2023
Same reason as rust-lang/log#536 :

`cfg_if` is only used in a single place and `tracing` is used by many
other crates, so even removing one dependency will be beneficial.

Remove dependency `cfg-if` and replace `cfg_if::cfg_if!` with a `const
fn get_max_level_inner() -> LevelFilter` and uses `if cfg!(...)` inside.

Using if in const function is stablised in
[1.46](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1460-2020-08-27)
so this should work fine in msrv 1.56

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
; Conflicts:
;	tracing/Cargo.toml
;	tracing/src/level_filters.rs
hawkw added a commit that referenced this pull request Apr 25, 2023
# 0.1.38 (April 25th, 2023)

This `tracing` release changes the `Drop` implementation for
`Instrumented` `Future`s so that the attached `Span` is entered when
dropping the `Future`. This means that events emitted by the `Future`'s
`Drop` implementation will now be recorded within its `Span`. It also
adds `#[inline]` hints to methods called in the `event!` macro's
expansion, for an improvement in both binary size and performance.

Additionally, this release updates the `tracing-attributes` dependency
to [v0.1.24][attrs-0.1.24], which updates the [`syn`] dependency to
v2.x.x. `tracing-attributes` v0.1.24 also includes improvements to the
`#[instrument]` macro; see [the `tracing-attributes` 0.1.24 release
notes][attrs-0.1.24] for details.

### Added

- `Instrumented` futures will now enter the attached `Span` in their
  `Drop` implementation, allowing events emitted when dropping the
  future to occur within the span (#2562)
- `#[inline]` attributes for methods called by the `event!` macros,
  making generated code smaller (#2555)
- **attributes**: `level` argument to `#[instrument(err)]` and
  `#[instrument(ret)]` to override the level of the generated return
  value event (#2335)
- **attributes**: Improved compiler error message when `#[instrument]`
  is added to a `const fn` (#2418)

### Changed

- `tracing-attributes`: updated to [0.1.24][attrs-0.1.24]
- Removed unneeded `cfg-if` dependency (#2553)
- **attributes**: Updated [`syn`] dependency to 2.0 (#2516)

### Fixed

- **attributes**: Fix `clippy::unreachable` warnings in
  `#[instrument]`-generated code (#2356)
- **attributes**: Removed unused "visit" feature flag from `syn`
  dependency (#2530)

### Documented

- **attributes**: Documented default level for `#[instrument(err)]`
  (#2433)
- **attributes**: Improved documentation for levels in `#[instrument]`
  (#2350)

Thanks to @nitnelave, @jsgf, @Abhicodes-crypto, @LukeMathWalker,
@andrewpollack, @quad, @klensy, @davidpdrsn, @dbidwell94, @ldm0,
@NobodyXu, @ilsv, and @daxpedda for contributing to this release!

[`syn`]: https://crates.io/crates/syn
[attrs-0.1.24]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.24
hawkw added a commit that referenced this pull request Apr 25, 2023
# 0.1.38 (April 25th, 2023)

This `tracing` release changes the `Drop` implementation for
`Instrumented` `Future`s so that the attached `Span` is entered when
dropping the `Future`. This means that events emitted by the `Future`'s
`Drop` implementation will now be recorded within its `Span`. It also
adds `#[inline]` hints to methods called in the `event!` macro's
expansion, for an improvement in both binary size and performance.

Additionally, this release updates the `tracing-attributes` dependency
to [v0.1.24][attrs-0.1.24], which updates the [`syn`] dependency to
v2.x.x. `tracing-attributes` v0.1.24 also includes improvements to the
`#[instrument]` macro; see [the `tracing-attributes` 0.1.24 release
notes][attrs-0.1.24] for details.

### Added

- `Instrumented` futures will now enter the attached `Span` in their
  `Drop` implementation, allowing events emitted when dropping the
  future to occur within the span (#2562)
- `#[inline]` attributes for methods called by the `event!` macros,
  making generated code smaller (#2555)
- **attributes**: `level` argument to `#[instrument(err)]` and
  `#[instrument(ret)]` to override the level of the generated return
  value event (#2335)
- **attributes**: Improved compiler error message when `#[instrument]`
  is added to a `const fn` (#2418)

### Changed

- `tracing-attributes`: updated to [0.1.24][attrs-0.1.24]
- Removed unneeded `cfg-if` dependency (#2553)
- **attributes**: Updated [`syn`] dependency to 2.0 (#2516)

### Fixed

- **attributes**: Fix `clippy::unreachable` warnings in
  `#[instrument]`-generated code (#2356)
- **attributes**: Removed unused "visit" feature flag from `syn`
  dependency (#2530)

### Documented

- **attributes**: Documented default level for `#[instrument(err)]`
  (#2433)
- **attributes**: Improved documentation for levels in `#[instrument]`
  (#2350)

Thanks to @nitnelave, @jsgf, @Abhicodes-crypto, @LukeMathWalker,
@andrewpollack, @quad, @klensy, @davidpdrsn, @dbidwell94, @ldm0,
@NobodyXu, @ilsv, and @daxpedda for contributing to this release!

[`syn`]: https://crates.io/crates/syn
[attrs-0.1.24]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.24
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.

None yet

2 participants