summaryrefslogtreecommitdiffstats
path: root/tests/ui/privacy/auxiliary/reachable-unnameable-items.rs
blob: 20f110b1a8cfdb4eb338e0a0b6ada41b96d1b1a9 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
use inner_private_module::*;

mod inner_private_module {
    pub struct Unnameable1;
    pub struct Unnameable2;
    #[derive(Clone, Copy)]
    pub struct Unnameable3;
    pub struct Unnameable4;
    pub struct Unnameable5;
    pub struct Unnameable6;
    pub struct Unnameable7;
    #[derive(Default)]
    pub struct Unnameable8;
    pub enum UnnameableEnum {
        NameableVariant
    }
    pub trait UnnameableTrait {
        type Alias: Default;
    }

    impl Unnameable1 {
        pub fn method_of_unnameable_type1(&self) -> &'static str {
            "Hello1"
        }
    }
    impl Unnameable2 {
        pub fn method_of_unnameable_type2(&self) -> &'static str {
            "Hello2"
        }
    }
    impl Unnameable3 {
        pub fn method_of_unnameable_type3(&self) -> &'static str {
            "Hello3"
        }
    }
    impl Unnameable4 {
        pub fn method_of_unnameable_type4(&self) -> &'static str {
            "Hello4"
        }
    }
    impl Unnameable5 {
        pub fn method_of_unnameable_type5(&self) -> &'static str {
            "Hello5"
        }
    }
    impl Unnameable6 {
        pub fn method_of_unnameable_type6(&self) -> &'static str {
            "Hello6"
        }
    }
    impl Unnameable7 {
        pub fn method_of_unnameable_type7(&self) -> &'static str {
            "Hello7"
        }
    }
    impl Unnameable8 {
        pub fn method_of_unnameable_type8(&self) -> &'static str {
            "Hello8"
        }
    }
    impl UnnameableEnum {
        pub fn method_of_unnameable_enum(&self) -> &'static str {
            "HelloEnum"
        }
    }
}

pub fn function_returning_unnameable_type() -> Unnameable1 {
    Unnameable1
}

pub const CONSTANT_OF_UNNAMEABLE_TYPE: Unnameable2 =
                                            Unnameable2;

pub fn function_accepting_unnameable_type(_: Option<Unnameable3>) {}

pub type AliasOfUnnameableType = Unnameable4;

impl Unnameable1 {
    pub fn inherent_method_returning_unnameable_type(&self) -> Unnameable5 {
        Unnameable5
    }
}

pub trait Tr {
    fn trait_method_returning_unnameable_type(&self) -> Unnameable6 {
        Unnameable6
    }
}
impl Tr for Unnameable1 {}

pub use inner_private_module::UnnameableEnum::NameableVariant;

pub struct Struct {
    pub field_of_unnameable_type: Unnameable7
}

pub static STATIC: Struct = Struct { field_of_unnameable_type: Unnameable7 } ;

impl UnnameableTrait for AliasOfUnnameableType {
    type Alias = Unnameable8;
}

pub fn generic_function<T: UnnameableTrait>() -> T::Alias {
    Default::default()
}