]> git.lizzy.rs Git - rust.git/blob - src/test/ui/auxiliary/reachable-unnameable-items.rs
Merge commit 'cd4810de42c57b64b74dae09c530a4c3a41f87b9' into libgccjit-codegen
[rust.git] / src / test / ui / auxiliary / reachable-unnameable-items.rs
1 use inner_private_module::*;
2
3 mod inner_private_module {
4     pub struct Unnameable1;
5     pub struct Unnameable2;
6     #[derive(Clone, Copy)]
7     pub struct Unnameable3;
8     pub struct Unnameable4;
9     pub struct Unnameable5;
10     pub struct Unnameable6;
11     pub struct Unnameable7;
12     #[derive(Default)]
13     pub struct Unnameable8;
14     pub enum UnnameableEnum {
15         NameableVariant
16     }
17     pub trait UnnameableTrait {
18         type Alias: Default;
19     }
20
21     impl Unnameable1 {
22         pub fn method_of_unnameable_type1(&self) -> &'static str {
23             "Hello1"
24         }
25     }
26     impl Unnameable2 {
27         pub fn method_of_unnameable_type2(&self) -> &'static str {
28             "Hello2"
29         }
30     }
31     impl Unnameable3 {
32         pub fn method_of_unnameable_type3(&self) -> &'static str {
33             "Hello3"
34         }
35     }
36     impl Unnameable4 {
37         pub fn method_of_unnameable_type4(&self) -> &'static str {
38             "Hello4"
39         }
40     }
41     impl Unnameable5 {
42         pub fn method_of_unnameable_type5(&self) -> &'static str {
43             "Hello5"
44         }
45     }
46     impl Unnameable6 {
47         pub fn method_of_unnameable_type6(&self) -> &'static str {
48             "Hello6"
49         }
50     }
51     impl Unnameable7 {
52         pub fn method_of_unnameable_type7(&self) -> &'static str {
53             "Hello7"
54         }
55     }
56     impl Unnameable8 {
57         pub fn method_of_unnameable_type8(&self) -> &'static str {
58             "Hello8"
59         }
60     }
61     impl UnnameableEnum {
62         pub fn method_of_unnameable_enum(&self) -> &'static str {
63             "HelloEnum"
64         }
65     }
66 }
67
68 pub fn function_returning_unnameable_type() -> Unnameable1 {
69     Unnameable1
70 }
71
72 pub const CONSTANT_OF_UNNAMEABLE_TYPE: Unnameable2 =
73                                             Unnameable2;
74
75 pub fn function_accepting_unnameable_type(_: Option<Unnameable3>) {}
76
77 pub type AliasOfUnnameableType = Unnameable4;
78
79 impl Unnameable1 {
80     pub fn inherent_method_returning_unnameable_type(&self) -> Unnameable5 {
81         Unnameable5
82     }
83 }
84
85 pub trait Tr {
86     fn trait_method_returning_unnameable_type(&self) -> Unnameable6 {
87         Unnameable6
88     }
89 }
90 impl Tr for Unnameable1 {}
91
92 pub use inner_private_module::UnnameableEnum::NameableVariant;
93
94 pub struct Struct {
95     pub field_of_unnameable_type: Unnameable7
96 }
97
98 pub static STATIC: Struct = Struct { field_of_unnameable_type: Unnameable7 } ;
99
100 impl UnnameableTrait for AliasOfUnnameableType {
101     type Alias = Unnameable8;
102 }
103
104 pub fn generic_function<T: UnnameableTrait>() -> T::Alias {
105     Default::default()
106 }