about summary refs log tree commit diff
path: root/src/libcore/core.rc
blob: 84c0568797c9f0242f70982726f840908fee9742 (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
#[link(name = "core",
       vers = "0.3",
       uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8",
       url = "https://github.com/mozilla/rust/tree/master/src/libcore")];

#[comment = "The Rust core library"];
#[license = "MIT"];
#[crate_type = "lib"];

/*!
 * The Rust core library provides functionality that is closely tied to the
 * Rust built-in types and runtime services, or that is used in nearly every
 * non-trivial program.
 *
 * `core` includes modules corresponding to each of the integer types, each of
 * the floating point types, the `bool` type, tuples, characters, strings,
 * vectors (`vec`), shared boxes (`box`), and unsafe pointers (`ptr`).
 * Additionally, `core` provides very commonly used built-in types and
 * operations, concurrency primitives, platform abstractions, I/O, and
 * complete bindings to the C standard library.
 *
 * `core` is linked by default to all crates and the contents imported.
 * Implicitly, all crates behave as if they included the following prologue:
 *
 *     use core;
 *     import core::*;
 *
 * This behavior can be disabled with the `#[no_core]` crate attribute.
 */

// Don't link to core. We are core.
#[no_core];

#[allow(vecs_implicitly_copyable)];

export int, i8, i16, i32, i64;
export uint, u8, u16, u32, u64;
export float, f32, f64;
export box, char, str, ptr, vec, at_vec, bool;
export either, option, result, iter;
export libc, os, io, run, rand, sys, unsafe, logging;
export comm, task, future, pipes;
export extfmt;
// The test harness links against core, so don't include runtime in tests.
// FIXME (#2861): Uncomment this after snapshot gets updated.
//#[cfg(notest)]
export rt;
export tuple;
export to_str, to_bytes;
export util;
export dvec, dvec_iter;
export dlist, dlist_iter;
export send_map;
export hash;
export cmp;
export num;
export path, path2;
export managed;

// NDM seems to be necessary for resolve to work
export option_iter;

// This creates some APIs that I do not want to commit to, but it must be
// exported from core in order for uv to remain in std (see #2648).
export priv;


// Built-in-type support modules

/// Operations and constants for `int`
#[warn(non_camel_case_types)]
#[path = "int-template"]
mod int {
    import inst::{ hash, pow };
    export hash, pow;
    #[path = "int.rs"]
    mod inst;
}

/// Operations and constants for `i8`
#[warn(non_camel_case_types)]
#[path = "int-template"]
mod i8 {
    #[path = "i8.rs"]
    mod inst;
}

/// Operations and constants for `i16`
#[warn(non_camel_case_types)]
#[path = "int-template"]
mod i16 {
    #[path = "i16.rs"]
    mod inst;
}

/// Operations and constants for `i32`
#[warn(non_camel_case_types)]
#[path = "int-template"]
mod i32 {
    #[path = "i32.rs"]
    mod inst;
}

/// Operations and constants for `i64`
#[warn(non_camel_case_types)]
#[path = "int-template"]
mod i64 {
    #[path = "i64.rs"]
    mod inst;
}

/// Operations and constants for `uint`
#[warn(non_camel_case_types)]
#[path = "uint-template"]
mod uint {
    import inst::{
        div_ceil, div_round, div_floor, hash, iterate,
        next_power_of_two
    };
    export div_ceil, div_round, div_floor, hash, iterate,
    next_power_of_two;

    #[path = "uint.rs"]
    mod inst;
}

/// Operations and constants for `u8`
#[warn(non_camel_case_types)]
#[path = "uint-template"]
mod u8 {
    import inst::is_ascii;
    export is_ascii;

    #[path = "u8.rs"]
    mod inst;
}

/// Operations and constants for `u16`
#[warn(non_camel_case_types)]
#[path = "uint-template"]
mod u16 {
    #[path = "u16.rs"]
    mod inst;
}

/// Operations and constants for `u32`
#[warn(non_camel_case_types)]
#[path = "uint-template"]
mod u32 {
    #[path = "u32.rs"]
    mod inst;
}

/// Operations and constants for `u64`
#[warn(non_camel_case_types)]
#[path = "uint-template"]
mod u64 {
    #[path = "u64.rs"]
    mod inst;
}


#[warn(non_camel_case_types)]
mod box;
#[warn(non_camel_case_types)]
mod char;
#[warn(non_camel_case_types)]
mod float;
#[warn(non_camel_case_types)]
mod f32;
#[warn(non_camel_case_types)]
mod f64;
#[warn(non_camel_case_types)]
mod str;
#[warn(non_camel_case_types)]
mod ptr;
#[warn(non_camel_case_types)]
mod vec;
#[warn(non_camel_case_types)]
mod at_vec;
#[warn(non_camel_case_types)]
mod bool;
#[warn(non_camel_case_types)]
mod tuple;

// Ubiquitous-utility-type modules

#[cfg(notest)]
mod ops;
#[warn(non_camel_case_types)]
mod cmp;
#[warn(non_camel_case_types)]
mod num;
#[warn(non_camel_case_types)]
mod hash;
#[warn(non_camel_case_types)]
mod either;
#[warn(non_camel_case_types)]
mod iter;
#[warn(non_camel_case_types)]
mod logging;
mod option;
#[path="iter-trait"]
mod option_iter {
    #[path = "option.rs"]
    mod inst;
}
mod result;
#[warn(non_camel_case_types)]
mod to_str;
#[warn(non_camel_case_types)]
mod to_bytes;
#[warn(non_camel_case_types)]
mod util;

// Data structure modules

#[warn(non_camel_case_types)]
mod dvec;
#[path="iter-trait"]
#[warn(non_camel_case_types)]
mod dvec_iter {
    #[path = "dvec.rs"]
    mod inst;
}
#[warn(non_camel_case_types)]
mod dlist;
#[path="iter-trait"]
#[warn(non_camel_case_types)]
mod dlist_iter {
    #[path ="dlist.rs"]
    mod inst;
}
#[warn(non_camel_case_types)]
mod send_map;

// Concurrency
#[warn(non_camel_case_types)]
mod comm;
#[warn(non_camel_case_types)]
mod task;
//#[warn(non_camel_ase_types)] pipec code continues to trip this warning
mod future;
mod pipes;

// Runtime and language-primitive support

#[warn(non_camel_case_types)]
mod io;
mod libc;
#[warn(non_camel_case_types)]
mod os;
#[warn(non_camel_case_types)]
mod path;
mod path2;
#[warn(non_camel_case_types)]
mod rand;
#[warn(non_camel_case_types)]
mod run;
#[warn(non_camel_case_types)]
mod sys;
#[warn(non_camel_case_types)]
mod unsafe;

mod managed;

// Modules supporting compiler-generated code
// Exported but not part of the public interface

mod extfmt;
// The test harness links against core, so don't include runtime in tests.
#[cfg(notest)]
mod rt;


// For internal use, not exported

#[warn(non_camel_case_types)]
mod unicode;
#[warn(non_camel_case_types)]
mod priv;
#[warn(non_camel_case_types)]
mod cmath;
#[warn(non_camel_case_types)]
mod stackwalk;

// Local Variables:
// mode: rust;
// fill-column: 78;
// indent-tabs-mode: nil
// c-basic-offset: 4
// buffer-file-coding-system: utf-8-unix
// End: