Open
Description
openedon Jun 10, 2024
Code
#![warn(unnameable_types)]
pub mod foo {
pub fn get() -> bar::Baz {
bar::Baz
}
mod bar {
pub struct Baz;
}
}
Current output
warning: struct `Baz` is reachable but cannot be named
--> src/lib.rs:9:9
|
9 | pub struct Baz;
| ^^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(foo)`
|
note: the lint level is defined here
--> src/lib.rs:1:9
|
1 | #![warn(unnameable_types)]
| ^^^^^^^^^^^^^^^^
warning: `playground` (lib) generated 1 warning
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.27s
Desired output
- reachable at visibility `pub`, but can only be named at visibility `pub(foo)`
+ reachable at visibility `pub`, but can only be named at visibility `pub(in crate::foo)`
Rationale and extra context
pub(foo)
is not valid visibility syntax.
Rust Version
rustc 1.79.0 (129f3b996 2024-06-10)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: x86_64-apple-darwin
release: 1.79.0
LLVM version: 18.1.7
Note that this is the pre-release of stable 1.79.0. Nightly has the same flaw.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment