Skip to content

False positive on the unreachable_pub lint #52664

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

Closed
alexcrichton opened this issue Jul 24, 2018 · 3 comments
Closed

False positive on the unreachable_pub lint #52664

alexcrichton opened this issue Jul 24, 2018 · 3 comments
Labels
A-edition-2018 Area: The 2018 edition A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.

Comments

@alexcrichton
Copy link
Member

The following code:

#![crate_type = "lib"]
#![feature(rust_2018_preview)]
#![warn(rust_2018_idioms)]

pub use self::m1::foo;

mod m1 {
    pub use self::m2::foo;


    mod m2 {
        pub fn foo() {}
    }
}

when compiled yields:

warning: unreachable `pub` item
 --> src/lib.rs:8:5
  |
8 |     pub use self::m2::foo;
  |     ---^^^^^^^^^^^^^^^^^^^
  |     |
  |     help: consider restricting its visibility: `crate`
  |
note: lint level defined here
 --> src/lib.rs:3:9
  |
3 | #![warn(rust_2018_idioms)]
  |         ^^^^^^^^^^^^^^^^
  = note: #[warn(unreachable_pub)] implied by #[warn(rust_2018_idioms)]
  = help: or consider exporting it for use by other crates

but the corrected version doesn't compile!

@alexcrichton
Copy link
Member Author

cc @zackmdavis, do you know where this might be coming up?

@zackmdavis
Copy link
Member

Duplicate of #47816? I'm pretty busy right now, but might be able to take a look Saturday.

@alexcrichton
Copy link
Member Author

Indeed, thanks! No rush as well :)

@fmease fmease added A-edition-2018 Area: The 2018 edition A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. and removed A-edition-2018-lints labels Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2018 Area: The 2018 edition A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.
Projects
None yet
Development

No branches or pull requests

3 participants