Which error message you get with a non-ancestral pub(path) visibility restriction depends on the ordering of module declarations.
These two struct declarations produce different errors;
mod foo {
pub(in ::bar) struct Foo;
}
mod bar {
pub(in ::foo) struct Bar;
}
The second produces the correct error:
error: visibilities can only be restricted to ancestor modules
The first produces this, incorrect error:
error[E0578]: cannot find module `bar` in the crate root
Presumably the pub(path) code is operating on the assumption the path, if real, has already been walked (because any correct path would have been walked), but this is not the case.
Which error message you get with a non-ancestral
pub(path)visibility restriction depends on the ordering of module declarations.These two struct declarations produce different errors;
The second produces the correct error:
The first produces this, incorrect error:
Presumably the pub(path) code is operating on the assumption the path, if real, has already been walked (because any correct path would have been walked), but this is not the case.