summaryrefslogtreecommitdiffstats
path: root/tests/ui/privacy/crate-private-reexport.rs
blob: fa4f88666d8647e315de03edad9ab0c5bbc0f920 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
fn f1() {}
enum E1 { V }
struct S1 {
    #[rustfmt::skip]
    bar: i32,
}
mod m1 {
    pub use ::f1; //~ ERROR `f1` is only public within the crate, and cannot be re-exported outside
    pub use ::S1; //~ ERROR `S1` is only public within the crate, and cannot be re-exported outside
    pub use ::E1; //~ ERROR `E1` is only public within the crate, and cannot be re-exported outside
    pub use ::E1::V; //~ ERROR `V` is only public within the crate, and cannot be re-exported outside
}

pub(crate) fn f2() {}
pub(crate) enum E2 {
    V
}
pub(crate) struct S2 {
    #[rustfmt::skip]
    bar: i32,
}
mod m2 {
    pub use ::f2; //~ ERROR `f2` is only public within the crate, and cannot be re-exported outside
    pub use ::S2; //~ ERROR `S2` is only public within the crate, and cannot be re-exported outside
    pub use ::E2; //~ ERROR `E2` is only public within the crate, and cannot be re-exported outside
    pub use ::E2::V; //~ ERROR `V` is only public within the crate, and cannot be re-exported outside
}

mod m3 {
    pub(crate) fn f3() {}
    pub(crate) enum E3 {
        V
    }
    pub(crate) struct S3 {
        #[rustfmt::skip]
        bar: i32,
    }
}
pub use m3::f3; //~ ERROR `f3` is only public within the crate, and cannot be re-exported outside
pub use m3::S3; //~ ERROR `S3` is only public within the crate, and cannot be re-exported outside
pub use m3::E3; //~ ERROR `E3` is only public within the crate, and cannot be re-exported outside
pub use m3::E3::V; //~ ERROR `V` is only public within the crate, and cannot be re-exported outside

pub(self) fn f4() {}
pub use ::f4 as f5; //~ ERROR `f4` is only public within the crate, and cannot be re-exported outside

pub mod m10 {
    pub mod m {
        pub(super) fn f6() {}
        pub(crate) fn f7() {}
        pub(in crate::m10) fn f8() {}
    }
    pub use self::m::f6; //~ ERROR `f6` is private, and cannot be re-exported
    pub use self::m::f7; //~ ERROR `f7` is only public within the crate, and cannot be re-exported outside
    pub use self::m::f8; //~ ERROR `f8` is private, and cannot be re-exported
}
pub use m10::m::f6; //~ ERROR function `f6` is private
pub use m10::m::f7; //~ ERROR `f7` is only public within the crate, and cannot be re-exported outside
pub use m10::m::f8; //~ ERROR function `f8` is private

pub mod m11 {
    pub(self) fn f9() {}
}
pub use m11::f9; //~ ERROR function `f9` is private

fn main() {}