Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unreachable_pub false negative when an unreachable type is mentioned in a type alias #116604

Open
kpreid opened this issue Oct 10, 2023 · 0 comments
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. A-visibility Area: Visibility / privacy C-bug Category: This is a bug. L-unreachable_pub Lint: unreachable_pub T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@kpreid
Copy link
Contributor

kpreid commented Oct 10, 2023

I tried this code:

#![deny(unreachable_pub)]

mod foo {
    pub enum FooError {}
    pub type FooResult<T> = Result<T, FooError>;
}

pub use foo::FooResult;

I expected an unreachable_pub lint because FooError is unreachable. Instead, there is no diagnostic output.

The FooError type is in principle nameable via defining a suitable trait and associated type, but this is probably not the intent of the unreachable_pub lint; the author probably wants to be told to reexport FooError.

Meta

rustc --version --verbose:

rustc 1.73.0 (cc66ad468 2023-10-03)
binary: rustc
commit-hash: cc66ad468955717ab92600c770da8c1601a4ff33
commit-date: 2023-10-03
host: x86_64-apple-darwin
release: 1.73.0
LLVM version: 17.0.2
rustc 1.75.0-nightly (2bbb61989 2023-10-04)
binary: rustc
commit-hash: 2bbb6198933abf193c0ef1d18d9d70f99eed59ba
commit-date: 2023-10-04
host: x86_64-apple-darwin
release: 1.75.0-nightly
LLVM version: 17.0.2

@rustbot label +A-lint +A-visibility

@kpreid kpreid added the C-bug Category: This is a bug. label Oct 10, 2023
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. A-visibility Area: Visibility / privacy labels Oct 10, 2023
@saethlin saethlin added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Nov 15, 2023
@jieyouxu jieyouxu added the L-unreachable_pub Lint: unreachable_pub label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. A-visibility Area: Visibility / privacy C-bug Category: This is a bug. L-unreachable_pub Lint: unreachable_pub T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants