Skip to content

Avoid unused tracing dep attributes feature in syntax/parser crates #21107

@lmmx

Description

@lmmx

I'm using the ra_ap_syntax crate published from the crates/syntax dir in this repo and would like if it could feature-gate the tracing instrumentation (so I can avoid the dependencies it induces). This would reduce the crate tree size considerably.

I noticed the parser crate appeared to already do so:

default = ["tracing"]

but then it seems to have been unfinished, the feature was never used in the code:

let _p = tracing::info_span!("TopEntryPoint::parse", ?self).entered();

As such the parser crate did not compile when the tracing feature is configured out (--no-default-features).

louis 🚶 ~/lab/rust-analyzer/crates/parser $ cargo check --no-default-features
    Checking parser v0.0.0 (/home/louis/lab/rust-analyzer/crates/parser)
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `tracing`
  --> crates/parser/src/lib.rs:92:18
   |
92 |         let _p = tracing::info_span!("TopEntryPoint::parse", ?self).entered();
   |                  ^^^^^^^ use of unresolved module or unlinked crate `tracing`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `tracing`
  --> crates/parser/src/shortcuts.rs:29:18
   |
29 |         let _p = tracing::info_span!("LexedStr::to_input").entered();
   |                  ^^^^^^^ use of unresolved module or unlinked crate `tracing`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `tracing`
  --> crates/parser/src/lexed_str.rs:38:18
   |
38 |         let _p = tracing::info_span!("LexedStr::new").entered();
   |                  ^^^^^^^ use of unresolved module or unlinked crate `tracing`

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-featureCategory: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions