You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Darwin Grahams-MacBook-Pro.local 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec 6 19:02:12 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6031 arm64 arm Darwin
but also play.rust-lang.org.
Crates
tracing
Description
Marking a function with tracing::instrument obscures type visibility errors.
The following code has a warning that the pub function hi returns Foo, which is not pub:
structFoo{}pubfnhi() -> Foo{Foo{}}
and the error:
warning: type `Foo` is more private than the item `hi`
--> src/lib.rs:5:1
|
5 | pub fn hi() -> Foo {
| ^^^^^^^^^^^^^^^^^^ function `hi` is reachable at visibility `pub`
|
note: but type `Foo` is only usable at visibility `pub(crate)`
--> src/lib.rs:3:1
|
3 | struct Foo {}
| ^^^^^^^^^^
= note: `#[warn(private_interfaces)]` on by default
However, if I mark hi with tracing::instrument...:
use tracing;// 0.1.41;structFoo{}#[tracing::instrument]pubfnhi() -> Foo{Foo{}}
Bug Report
Version
tracing
0.1.41Platform
Darwin Grahams-MacBook-Pro.local 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec 6 19:02:12 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6031 arm64 arm Darwin
but also play.rust-lang.org.
Crates
Description
Marking a function with
tracing::instrument
obscures type visibility errors.The following code has a warning that the
pub
functionhi
returnsFoo
, which is notpub
:and the error:
However, if I mark
hi
withtracing::instrument
...:The warning goes away:
I would expect Rust to continue issuing warnings about these types.
The text was updated successfully, but these errors were encountered: