Closed as duplicate of#109657
Description
Code
mod a {
mod b {
pub(in crate::a) struct Foo;
pub(in crate::c) struct Bar;
}
}
mod c {}
Current output
error[E0433]: failed to resolve: could not find `c` in the crate root
--> src/lib.rs:4:23
|
4 | pub(in crate::c) struct Bar;
| ^ could not find `c` in the crate root
For more information about this error, try `rustc --explain E0433`.
Desired output
error[E0433]: invalid privacy specifier: `c` is not a parent module of `a::b`
--> src/lib.rs:4:23
|
4 | pub(in crate::c) struct Bar;
| ^ `c` is not a parent module of `a::b`
Rationale and extra context
No response
Other cases
Rust Version
$ rustc --version --verbose
rustc 1.87.0 (17067e9ac 2025-05-09)
binary: rustc
commit-hash: 17067e9ac6d7ecb70e50f92c1944e545188d2359
commit-date: 2025-05-09
host: x86_64-unknown-linux-gnu
release: 1.87.0
LLVM version: 20.1.1
Anything else?
No response