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
I've been experimenting with the exported_private_dependencies lint on nightly. I found it really useful in helping teams understand when a SemVer-breaking bump in one of their dependencies means the same for their crate. Therefore, I'm trying to have this lint on by default in CIs.
However, when depending on the futures crate, even if declaring it as public = true, I'll still get warnings like the following:
$ cargo +nightly clippy --no-deps -p my-crate --features client
Checking my-crate v0.21.0 (/home/doom/git/MyOrg/my-repo/crates/my-crate)
warning: trait `futures::Stream` from private dependency 'futures_core' in public interface
--> crates/my-crate/src/client.rs:285:1
|
285 | pub struct StreamWrapper<S, Ok>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(exported_private_dependencies)]` on by default
warning: trait `futures::Stream` from private dependency 'futures_core' in public interface
--> crates/my-crate/src/client.rs:300:1
|
The only solution I found for this was to:
directly depend on the futures-core crate to declare it as public; and
directly declare "dep:futures-core" for any features that use it
This turns out to be a bit annoying, as I was used to importing just futures so I could get both the core items and their extension traits + other utils. Now I have to import futures-core, futures-util, and so on.
Would updating the manifest file for futures to declare futures-util as public solve this issue? Was that not done already because it would be a breaking change?
The text was updated successfully, but these errors were encountered:
This appears to be a bug in that lint, or an area that cannot be addressed by our crate that targets stable Rust because that lint is unstable.
Therefore, I recommend that you submit the issue to the upstream project that is implementing this lint, rather than submitting it to a downstream project such as this project that is affected by this bug or limitation.
taiki-e
changed the title
Update manifests to declare public dependencies
False positive with unstable exported_private_dependencies
May 10, 2025
taiki-e
changed the title
False positive with unstable exported_private_dependencies
False positive with unstable exported_private_dependencies lint
May 10, 2025
Hi!
I've been experimenting with the
exported_private_dependencies
lint on nightly. I found it really useful in helping teams understand when a SemVer-breaking bump in one of their dependencies means the same for their crate. Therefore, I'm trying to have this lint on by default in CIs.However, when depending on the
futures
crate, even if declaring it aspublic = true
, I'll still get warnings like the following:The only solution I found for this was to:
futures-core
crate to declare it as public; and"dep:futures-core"
for any features that use itThis turns out to be a bit annoying, as I was used to importing just
futures
so I could get both the core items and their extension traits + other utils. Now I have to importfutures-core
,futures-util
, and so on.Would updating the manifest file for
futures
to declarefutures-util
as public solve this issue? Was that not done already because it would be a breaking change?The text was updated successfully, but these errors were encountered: