Closed
Description
What is this lint about
Private items cannot be used outside of their module
mod m {
struct S;
}
use m::S; // <- attempt to access a private item, privacy error is reported
, however, older versions of the compiler erroneously ignored privacy on extern crate items and accepted code like this without errors:
mod m {
extern crate c;
}
use m::c; // <- attempt to access a private item, privacy error was not reported in earlier compiler versions
#31362 fixed this oversight.
How to fix this warning/error
Mark the extern crate
as pub
if it's intended to be used from outside of the module it's defined in.
Current status
- resolve: fix the visibility of extern crates #31362 introduces the
inaccessible_extern_crate
lint as warn-by-default - Make sufficiently old or low-impact compatibility lints deny-by-default #36894 makes the
inaccessible_extern_crate
lint deny-by-default - Turn sufficiently old compatibility lints into hard errors #42136 makes the
inaccessible_extern_crate
lint a hard error