Skip to content

tracing: Consider Switching compile-time filters from Cargo features to RUSTFLAGS #2081

Open
@davidbarsky

Description

@davidbarsky

Feature Request

Crates

  • tracing

Motivation

Cargo's feature flags are global across the crate graph and are additive. This means if tracing's compile time filters are enabled in a dependent crate (often times, by accident!), all crates in the dependency graph will transitively enable the compile-time filter with no mechanism of disabling the feature in a consuming crate. This is not a good experience and introduces an ecosystem-wide papercuts.

Proposal

tracing 0.2 should remove the Cargo-based compile time filters from tracing and replace them with a RUSTFLAGS-based approach, similar to how Tokio enables unstable features. This means that only the root of the dependency of crate graph (a binary that takes a dependency on tracing) can enable a compile time filter. That filter cannot not be transitively added to other libraries or binaries since RUSTFLAGS are not part of a registry's crate metadata.

Alternatives

Don't do this and keep compile-time filters as is. Unfortunately, this is a papercut with ecosystem-wide risk.

cc: @oli-obk (impacts rustc's builds)

Metadata

Metadata

Assignees

No one assigned

    Labels

    crate/tracingRelated to the `tracing` crate

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions