aclysma / profiling

Provides a very thin abstraction over instrumented profiling crates like puffin, optick, tracy, and superluminal-perf.
Apache License 2.0
320 stars 39 forks source link

Compiler error when using profile-with-tracing with wgpu-core #21

Closed Shfty closed 3 years ago

Shfty commented 3 years ago

wgpu-core uses profiling for instrumentation, and fails to compile if a downstream crate enables the profile-with-tracing feature on a local profiling dependency.

Repro steps

This results in a lengthy set of compiler errors, the most prominent of which is failed to resolve: use of undeclared crate or module 'tracing' on each invocation of the profiling::scope macro, and expected type parameter 'B', found struct 'profiling::tracing::level_filters::LevelFilter' where the macro is invoked in a generic context.

The other feature flags don't exhibit this issue. Adding a tracing dependency to the wgpu-error binary crate causes the same outcome, as does using version = "1" for profiling to match its entry in the wgpu-core Cargo.toml, so this doesn't appear to be a local dependency or version mismatch issue.

Given that the tracing dependency is present in profiling as a re-export, and that its presence in wgpu-error makes no difference, I suspect that $crate is actually resolving to the nonexistent wgpu-core::tracing due to some quirk with macro expansion.

Relevant wgpu-core issue: https://github.com/gfx-rs/wgpu/issues/1477

aclysma commented 3 years ago

Published as 1.0.2