@@ -6,96 +6,96 @@ extern crate mini_core;
6
6
7
7
use mini_core:: * ;
8
8
9
- fn abc ( a : u8 ) -> u8 {
9
+ pub fn abc ( a : u8 ) -> u8 {
10
10
a * 2
11
11
}
12
12
13
- fn bcd ( b : bool , a : u8 ) -> u8 {
13
+ pub fn bcd ( b : bool , a : u8 ) -> u8 {
14
14
if b {
15
15
a * 2
16
16
} else {
17
17
a * 3
18
18
}
19
19
}
20
20
21
- fn call ( ) {
21
+ pub fn call ( ) {
22
22
abc ( 42 ) ;
23
23
}
24
24
25
- fn indirect_call ( ) {
25
+ pub fn indirect_call ( ) {
26
26
let f: fn ( ) = call;
27
27
f ( ) ;
28
28
}
29
29
30
- enum BoolOption {
30
+ pub enum BoolOption {
31
31
Some ( bool ) ,
32
32
None ,
33
33
}
34
34
35
- fn option_unwrap_or ( o : BoolOption , d : bool ) -> bool {
35
+ pub fn option_unwrap_or ( o : BoolOption , d : bool ) -> bool {
36
36
match o {
37
37
BoolOption :: Some ( b) => b,
38
38
BoolOption :: None => d,
39
39
}
40
40
}
41
41
42
- fn ret_42 ( ) -> u8 {
42
+ pub fn ret_42 ( ) -> u8 {
43
43
42
44
44
}
45
45
46
- fn return_str ( ) -> & ' static str {
46
+ pub fn return_str ( ) -> & ' static str {
47
47
"hello world"
48
48
}
49
49
50
- fn promoted_val ( ) -> & ' static u8 {
50
+ pub fn promoted_val ( ) -> & ' static u8 {
51
51
& ( 1 * 2 )
52
52
}
53
53
54
- fn cast_ref_to_raw_ptr ( abc : & u8 ) -> * const u8 {
54
+ pub fn cast_ref_to_raw_ptr ( abc : & u8 ) -> * const u8 {
55
55
abc as * const u8
56
56
}
57
57
58
- fn cmp_raw_ptr ( a : * const u8 , b : * const u8 ) -> bool {
58
+ pub fn cmp_raw_ptr ( a : * const u8 , b : * const u8 ) -> bool {
59
59
a == b
60
60
}
61
61
62
- fn int_cast ( a : u16 , b : i16 ) -> ( u8 , u16 , u32 , usize , i8 , i16 , i32 , isize , u8 , u32 ) {
62
+ pub fn int_cast ( a : u16 , b : i16 ) -> ( u8 , u16 , u32 , usize , i8 , i16 , i32 , isize , u8 , u32 ) {
63
63
(
64
64
a as u8 , a as u16 , a as u32 , a as usize , a as i8 , a as i16 , a as i32 , a as isize , b as u8 ,
65
65
b as u32 ,
66
66
)
67
67
}
68
68
69
- fn char_cast ( c : char ) -> u8 {
69
+ pub fn char_cast ( c : char ) -> u8 {
70
70
c as u8
71
71
}
72
72
73
73
pub struct DebugTuple ( ( ) ) ;
74
74
75
- fn debug_tuple ( ) -> DebugTuple {
75
+ pub fn debug_tuple ( ) -> DebugTuple {
76
76
DebugTuple ( ( ) )
77
77
}
78
78
79
- fn size_of < T > ( ) -> usize {
79
+ pub fn size_of < T > ( ) -> usize {
80
80
intrinsics:: size_of :: < T > ( )
81
81
}
82
82
83
- fn use_size_of ( ) -> usize {
83
+ pub fn use_size_of ( ) -> usize {
84
84
size_of :: < u64 > ( )
85
85
}
86
86
87
- unsafe fn use_copy_intrinsic ( src : * const u8 , dst : * mut u8 ) {
87
+ pub unsafe fn use_copy_intrinsic ( src : * const u8 , dst : * mut u8 ) {
88
88
intrinsics:: copy :: < u8 > ( src, dst, 1 ) ;
89
89
}
90
90
91
- unsafe fn use_copy_intrinsic_ref ( src : * const u8 , dst : * mut u8 ) {
91
+ pub unsafe fn use_copy_intrinsic_ref ( src : * const u8 , dst : * mut u8 ) {
92
92
let copy2 = & intrinsics:: copy :: < u8 > ;
93
93
copy2 ( src, dst, 1 ) ;
94
94
}
95
95
96
- const ABC : u8 = 6 * 7 ;
96
+ pub const ABC : u8 = 6 * 7 ;
97
97
98
- fn use_const ( ) -> u8 {
98
+ pub fn use_const ( ) -> u8 {
99
99
ABC
100
100
}
101
101
@@ -107,7 +107,7 @@ pub fn call_closure_2arg() {
107
107
( |_, _| { } ) ( 0u8 , 42u16 )
108
108
}
109
109
110
- struct IsNotEmpty ;
110
+ pub struct IsNotEmpty ;
111
111
112
112
impl < ' a , ' b > FnOnce < ( & ' a & ' b [ u16 ] , ) > for IsNotEmpty {
113
113
type Output = ( u8 , u8 ) ;
@@ -129,77 +129,77 @@ pub fn call_is_not_empty() {
129
129
IsNotEmpty . call_once ( ( & ( & [ 0u16 ] as & [ _ ] ) , ) ) ;
130
130
}
131
131
132
- fn eq_char ( a : char , b : char ) -> bool {
132
+ pub fn eq_char ( a : char , b : char ) -> bool {
133
133
a == b
134
134
}
135
135
136
- unsafe fn transmute ( c : char ) -> u32 {
136
+ pub unsafe fn transmute ( c : char ) -> u32 {
137
137
intrinsics:: transmute ( c)
138
138
}
139
139
140
- unsafe fn deref_str_ptr ( s : * const str ) -> & ' static str {
140
+ pub unsafe fn deref_str_ptr ( s : * const str ) -> & ' static str {
141
141
& * s
142
142
}
143
143
144
- fn use_array ( arr : [ u8 ; 3 ] ) -> u8 {
144
+ pub fn use_array ( arr : [ u8 ; 3 ] ) -> u8 {
145
145
arr[ 1 ]
146
146
}
147
147
148
- fn repeat_array ( ) -> [ u8 ; 3 ] {
148
+ pub fn repeat_array ( ) -> [ u8 ; 3 ] {
149
149
[ 0 ; 3 ]
150
150
}
151
151
152
- fn array_as_slice ( arr : & [ u8 ; 3 ] ) -> & [ u8 ] {
152
+ pub fn array_as_slice ( arr : & [ u8 ; 3 ] ) -> & [ u8 ] {
153
153
arr
154
154
}
155
155
156
- unsafe fn use_ctlz_nonzero ( a : u16 ) -> u16 {
156
+ pub unsafe fn use_ctlz_nonzero ( a : u16 ) -> u16 {
157
157
intrinsics:: ctlz_nonzero ( a)
158
158
}
159
159
160
- fn ptr_as_usize ( ptr : * const u8 ) -> usize {
160
+ pub fn ptr_as_usize ( ptr : * const u8 ) -> usize {
161
161
ptr as usize
162
162
}
163
163
164
- fn float_cast ( a : f32 , b : f64 ) -> ( f64 , f32 ) {
164
+ pub fn float_cast ( a : f32 , b : f64 ) -> ( f64 , f32 ) {
165
165
( a as f64 , b as f32 )
166
166
}
167
167
168
- fn int_to_float ( a : u8 , b : i32 ) -> ( f64 , f32 ) {
168
+ pub fn int_to_float ( a : u8 , b : i32 ) -> ( f64 , f32 ) {
169
169
( a as f64 , b as f32 )
170
170
}
171
171
172
- fn make_array ( ) -> [ u8 ; 3 ] {
172
+ pub fn make_array ( ) -> [ u8 ; 3 ] {
173
173
[ 42 , 0 , 5 ]
174
174
}
175
175
176
- fn some_promoted_tuple ( ) -> & ' static ( & ' static str , & ' static str ) {
176
+ pub fn some_promoted_tuple ( ) -> & ' static ( & ' static str , & ' static str ) {
177
177
& ( "abc" , "some" )
178
178
}
179
179
180
- fn index_slice ( s : & [ u8 ] ) -> u8 {
180
+ pub fn index_slice ( s : & [ u8 ] ) -> u8 {
181
181
s[ 2 ]
182
182
}
183
183
184
184
pub struct StrWrapper {
185
185
s : str ,
186
186
}
187
187
188
- fn str_wrapper_get ( w : & StrWrapper ) -> & str {
188
+ pub fn str_wrapper_get ( w : & StrWrapper ) -> & str {
189
189
& w. s
190
190
}
191
191
192
- fn i16_as_i8 ( a : i16 ) -> i8 {
192
+ pub fn i16_as_i8 ( a : i16 ) -> i8 {
193
193
a as i8
194
194
}
195
195
196
- struct Unsized ( u8 , str ) ;
196
+ pub struct Unsized ( u8 , str ) ;
197
197
198
- fn get_sized_field_ref_from_unsized_type ( u : & Unsized ) -> & u8 {
198
+ pub fn get_sized_field_ref_from_unsized_type ( u : & Unsized ) -> & u8 {
199
199
& u. 0
200
200
}
201
201
202
- fn get_unsized_field_ref_from_unsized_type ( u : & Unsized ) -> & str {
202
+ pub fn get_unsized_field_ref_from_unsized_type ( u : & Unsized ) -> & str {
203
203
& u. 1
204
204
}
205
205
0 commit comments