unreachable_pub
lint thinks a pub fn in a pub(crate) struct is public
#110922
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
A-visibility
Area: Visibility / privacy
C-bug
Category: This is a bug.
I tried this code:
I expected that this code would compile without warnings, because the
Foo
struct isn't visible outside the crate, and thus its associated functions won't be visible either (I'm making a bit of an assumption on this point; maybe you can access a private struct's functions outside the crate, and I just don't know enough Rust to know how?)Instead, the compiler output this warning:
Meta
rustc --version --verbose
:The output is the same if I run with
rustup run nightly cargo build
, whererustup run nightly rustc --version --verbose
says:The text was updated successfully, but these errors were encountered: