3 #![feature(crate_visibility_modifier)]
6 #![warn(unreachable_pub)]
9 // non-leaked `pub` items in private module should be linted
10 pub use std::fmt; //~ WARNING unreachable_pub
11 pub use std::env::{Args}; // braced-use has different item spans than unbraced
12 //~^ WARNING unreachable_pub
14 pub struct Hydrogen { //~ WARNING unreachable_pub
15 // `pub` struct fields, too
16 pub neutrons: usize, //~ WARNING unreachable_pub
17 // (... but not more-restricted fields)
18 crate electrons: usize
22 pub fn count_neutrons(&self) -> usize { self.neutrons } //~ WARNING unreachable_pub
23 crate fn count_electrons(&self) -> usize { self.electrons }
26 pub enum Helium {} //~ WARNING unreachable_pub
27 pub union Lithium { c1: usize, c2: u8 } //~ WARNING unreachable_pub
28 pub fn beryllium() {} //~ WARNING unreachable_pub
29 pub trait Boron {} //~ WARNING unreachable_pub
30 pub const CARBON: usize = 1; //~ WARNING unreachable_pub
31 pub static NITROGEN: usize = 2; //~ WARNING unreachable_pub
32 pub type Oxygen = bool; //~ WARNING unreachable_pub
34 macro_rules! define_empty_struct_with_visibility {
35 ($visibility: vis, $name: ident) => { $visibility struct $name {} }
36 //~^ WARNING unreachable_pub
38 define_empty_struct_with_visibility!(pub, Fluorine);
41 pub fn catalyze() -> bool; //~ WARNING unreachable_pub
44 // items leaked through signatures (see `get_neon` below) are OK
47 // crate-visible items are OK
48 crate struct Sodium {}
52 // module is public: these are OK, too
53 pub struct Magnesium {}
54 crate struct Aluminum {}
57 pub fn get_neon() -> private_mod::Neon {