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

subscriber: feature flags that require std enable it #1660

Merged
merged 2 commits into from
Oct 20, 2021

Commits on Oct 20, 2021

  1. subscriber: feature flags that require std enable it

    ## Motivation
    
    Currently, some `tracing-subscriber` dependencies in other crates use
    `default-features = false`, to ensure that unneeded default features of
    `tracing-subscriber` are not inadvertently enabled. However, some of the
    features those crates enable also require the `std` feature flag. The
    `default-features = false` config _disables_ the `std` feature, so the
    required features are not available.
    
    ## Solution
    
    This branch changes `tracing-subscriber`'s `fmt`, `registry`, and
    `env-filter` feature flags to also enable the `std` feature flag
    automatically.
    
    ## Alternatives
    
    As an alternative solution, we could change crates that depend on
    `tracing-subscriber` with `default-features = false` to also explicitly
    ensure that the `std` feature is enabled (which might be worth doing
    regardless). This is what PR #1659 does. However, I think the approach
    in this branch is more correct; the feature flags that require standard
    library support should automatically enable it. This provides a better
    experience for most users, who are simply adding `default-features = false`
    in order to avoid enabling un-needed features, not to support
    `no_std`, and would like enabling a feature flag to *actually* enable
    that feature.
    
    `no_std` users will know not to enable `registry`, `fmt`, and
    `env-filter` because the documentation notes that those features require
    the standard library.
    hawkw committed Oct 20, 2021
    Configuration menu
    Copy the full SHA
    0e22d57 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ffe7f5f View commit details
    Browse the repository at this point in the history