I tried this code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=028239a954b1baf0326d31262947a247 ```rust #![warn(unreachable_pub)] use inner::FlowData; mod inner { pub struct FlowData { pub data: Vec<u8>, } } pub fn f() -> tokio::sync::mpsc::Receiver<FlowData> { todo!() } async fn foo() { println!("{:?}", f().recv().await.unwrap().data); } ``` I expected to see this happen: No unreachable_pub lint. `foo` only uses publicly accessible APIs, it never mentions `inner`. Instead, this happened: ``` warning: unreachable `pub` field --> src/lib.rs:6:9 | 6 | pub data: Vec<u8>, | ---^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | note: the lint level is defined here --> src/lib.rs:1:9 | 1 | #![warn(unreachable_pub)] | ^^^^^^^^^^^^^^^ ``` cc @petrochenkov ### Meta <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --> `rustc --version --verbose`: 1.60.0-nightly (2022-01-13 22e491ac7ed454d34669)
Activity
jyn514 commentedon Jan 14, 2022
In particular, it seems wrong to say that a public field is unreachable whenever the type it belongs to is publicly reachable.
tmiasko commentedon Jan 14, 2022
This was fixed in #92781 (not available as nightly yet).
jyn514 commentedon Jan 18, 2022
Yes it was, thank you!