Skip to content

Regression: false positive from unreachable_pub lint #102352

Closed
@djc

Description

@djc

Code

I tried this code:

#![deny(unreachable_pub)]

pub use crate::builder::Foo;

mod builder {
    pub struct Foo(pub(crate) ());
}

I expected to see no output from the compiler.

Instead, this happened:

djc-2021 main test-rs $ cargo +nightly c
    Checking test-rs v0.1.0 (/Users/djc/src/test-rs)
error: unreachable `pub` item
 --> src/lib.rs:3:9
  |
3 | pub use crate::builder::Foo;
  | ---     ^^^^^^^^^^^^^^^^^^^
  | |
  | help: consider restricting its visibility: `pub(crate)`
  |

cargo-bisect-rustc ouptut

searched nightlies: from nightly-2022-09-22 to nightly-2022-09-27
regressed nightly: nightly-2022-09-25
searched commit range: 4a14677...3f83906
regressed commit: 6580010

This is a roll-up, #102109 seems the most likely culprit. cc @petrochenkov @oli-obk

bisected with cargo-bisect-rustc v0.6.4

Host triple: aarch64-apple-darwin
Reproduce with:

cargo bisect-rustc --start=2022-09-22 

@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged

Metadata

Metadata

Labels

A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-visibilityArea: Visibility / privacyC-bugCategory: This is a bug.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions