]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
11 | //! # The Rust Core Library | |
12 | //! | |
92a42be0 | 13 | //! The Rust Core Library is the dependency-free[^free] foundation of [The |
1a4d82fc JJ |
14 | //! Rust Standard Library](../std/index.html). It is the portable glue |
15 | //! between the language and its libraries, defining the intrinsic and | |
16 | //! primitive building blocks of all Rust code. It links to no | |
17 | //! upstream libraries, no system libraries, and no libc. | |
18 | //! | |
92a42be0 SL |
19 | //! [^free]: Strictly speaking, there are some symbols which are needed but |
20 | //! they aren't always necessary. | |
21 | //! | |
1a4d82fc JJ |
22 | //! The core library is *minimal*: it isn't even aware of heap allocation, |
23 | //! nor does it provide concurrency or I/O. These things require | |
24 | //! platform integration, and this library is platform-agnostic. | |
25 | //! | |
1a4d82fc JJ |
26 | //! # How to use the core library |
27 | //! | |
5bcae85e SL |
28 | //! Please note that all of these details are currently not considered stable. |
29 | //! | |
1a4d82fc JJ |
30 | // FIXME: Fill me in with more detail when the interface settles |
31 | //! This library is built on the assumption of a few existing symbols: | |
32 | //! | |
33 | //! * `memcpy`, `memcmp`, `memset` - These are core memory routines which are | |
34 | //! often generated by LLVM. Additionally, this library can make explicit | |
35 | //! calls to these functions. Their signatures are the same as found in C. | |
36 | //! These functions are often provided by the system libc, but can also be | |
c34b1796 | 37 | //! provided by the [rlibc crate](https://crates.io/crates/rlibc). |
1a4d82fc | 38 | //! |
041b39d2 XL |
39 | //! * `rust_begin_panic` - This function takes four arguments, a |
40 | //! `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments | |
5bcae85e | 41 | //! dictate the panic message, the file at which panic was invoked, and the |
041b39d2 XL |
42 | //! line and column inside the file. It is up to consumers of this core |
43 | //! library to define this panic function; it is only required to never | |
44 | //! return. This requires a `lang` attribute named `panic_fmt`. | |
9e0c209e SL |
45 | //! |
46 | //! * `rust_eh_personality` - is used by the failure mechanisms of the | |
47 | //! compiler. This is often mapped to GCC's personality function, but crates | |
48 | //! which do not trigger a panic can be assured that this function is never | |
49 | //! called. The `lang` attribute is called `eh_personality`. | |
1a4d82fc JJ |
50 | |
51 | // Since libcore defines many fundamental lang items, all tests live in a | |
52 | // separate crate, libcoretest, to avoid bizarre issues. | |
53 | ||
92a42be0 | 54 | #![stable(feature = "core", since = "1.6.0")] |
e9174d1e | 55 | #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", |
62682a34 | 56 | html_favicon_url = "https://doc.rust-lang.org/favicon.ico", |
e9174d1e SL |
57 | html_root_url = "https://doc.rust-lang.org/nightly/", |
58 | html_playground_url = "https://play.rust-lang.org/", | |
92a42be0 SL |
59 | issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", |
60 | test(no_crate_inject, attr(deny(warnings))), | |
61 | test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))] | |
1a4d82fc | 62 | |
e9174d1e | 63 | #![no_core] |
1a4d82fc | 64 | #![deny(missing_docs)] |
54a0048b | 65 | #![deny(missing_debug_implementations)] |
32a655c1 | 66 | #![deny(warnings)] |
1a4d82fc | 67 | |
e9174d1e | 68 | #![feature(allow_internal_unstable)] |
a7813a04 | 69 | #![feature(asm)] |
62682a34 | 70 | #![feature(associated_type_defaults)] |
0531ce1d | 71 | #![feature(attr_literals)] |
a7813a04 | 72 | #![feature(cfg_target_feature)] |
cc61c64b | 73 | #![feature(cfg_target_has_atomic)] |
e9174d1e SL |
74 | #![feature(concat_idents)] |
75 | #![feature(const_fn)] | |
76 | #![feature(custom_attribute)] | |
0531ce1d XL |
77 | #![feature(doc_cfg)] |
78 | #![feature(doc_spotlight)] | |
79 | #![feature(fn_must_use)] | |
e9174d1e | 80 | #![feature(fundamental)] |
0531ce1d XL |
81 | #![cfg_attr(stage0, feature(i128_type))] |
82 | #![cfg_attr(stage0, feature(inclusive_range_syntax))] | |
62682a34 | 83 | #![feature(intrinsics)] |
0531ce1d XL |
84 | #![feature(iterator_flatten)] |
85 | #![feature(iterator_repeat_with)] | |
62682a34 | 86 | #![feature(lang_items)] |
0531ce1d | 87 | #![feature(link_llvm_intrinsics)] |
cc61c64b | 88 | #![feature(never_type)] |
0531ce1d XL |
89 | #![feature(exhaustive_patterns)] |
90 | #![feature(macro_at_most_once_rep)] | |
e9174d1e | 91 | #![feature(no_core)] |
85aaf69f | 92 | #![feature(on_unimplemented)] |
c34b1796 | 93 | #![feature(optin_builtin_traits)] |
cc61c64b | 94 | #![feature(prelude_import)] |
9cc50fc6 | 95 | #![feature(repr_simd, platform_intrinsics)] |
54a0048b | 96 | #![feature(rustc_attrs)] |
0531ce1d XL |
97 | #![feature(rustc_const_unstable)] |
98 | #![feature(simd_ffi)] | |
54a0048b | 99 | #![feature(specialization)] |
e9174d1e | 100 | #![feature(staged_api)] |
0531ce1d XL |
101 | #![feature(stmt_expr_attributes)] |
102 | #![feature(target_feature)] | |
e9174d1e | 103 | #![feature(unboxed_closures)] |
cc61c64b XL |
104 | #![feature(untagged_unions)] |
105 | #![feature(unwind_attributes)] | |
0531ce1d XL |
106 | |
107 | #![cfg_attr(stage0, allow(unused_attributes))] | |
108 | #![cfg_attr(stage0, feature(never_type))] | |
ea8adc8c | 109 | |
9e0c209e SL |
110 | #[prelude_import] |
111 | #[allow(unused)] | |
112 | use prelude::v1::*; | |
5bcae85e | 113 | |
1a4d82fc JJ |
114 | #[macro_use] |
115 | mod macros; | |
116 | ||
c30ab7b3 SL |
117 | #[macro_use] |
118 | mod internal_macros; | |
119 | ||
1a4d82fc JJ |
120 | #[path = "num/int_macros.rs"] |
121 | #[macro_use] | |
122 | mod int_macros; | |
123 | ||
124 | #[path = "num/uint_macros.rs"] | |
125 | #[macro_use] | |
126 | mod uint_macros; | |
127 | ||
5bcae85e SL |
128 | #[path = "num/isize.rs"] pub mod isize; |
129 | #[path = "num/i8.rs"] pub mod i8; | |
130 | #[path = "num/i16.rs"] pub mod i16; | |
131 | #[path = "num/i32.rs"] pub mod i32; | |
132 | #[path = "num/i64.rs"] pub mod i64; | |
32a655c1 SL |
133 | #[path = "num/i128.rs"] pub mod i128; |
134 | ||
1a4d82fc | 135 | #[path = "num/usize.rs"] pub mod usize; |
5bcae85e SL |
136 | #[path = "num/u8.rs"] pub mod u8; |
137 | #[path = "num/u16.rs"] pub mod u16; | |
138 | #[path = "num/u32.rs"] pub mod u32; | |
139 | #[path = "num/u64.rs"] pub mod u64; | |
32a655c1 SL |
140 | #[path = "num/u128.rs"] pub mod u128; |
141 | ||
1a4d82fc JJ |
142 | #[path = "num/f32.rs"] pub mod f32; |
143 | #[path = "num/f64.rs"] pub mod f64; | |
144 | ||
9346a6ac | 145 | #[macro_use] |
1a4d82fc JJ |
146 | pub mod num; |
147 | ||
148 | /* The libcore prelude, not as all-encompassing as the libstd prelude */ | |
149 | ||
150 | pub mod prelude; | |
151 | ||
152 | /* Core modules for ownership management */ | |
153 | ||
154 | pub mod intrinsics; | |
155 | pub mod mem; | |
156 | pub mod nonzero; | |
157 | pub mod ptr; | |
158 | ||
159 | /* Core language traits */ | |
160 | ||
161 | pub mod marker; | |
162 | pub mod ops; | |
163 | pub mod cmp; | |
164 | pub mod clone; | |
165 | pub mod default; | |
c34b1796 | 166 | pub mod convert; |
e9174d1e | 167 | pub mod borrow; |
1a4d82fc JJ |
168 | |
169 | /* Core types and methods on primitives */ | |
170 | ||
171 | pub mod any; | |
c34b1796 | 172 | pub mod array; |
0531ce1d | 173 | pub mod ascii; |
e9174d1e | 174 | pub mod sync; |
1a4d82fc JJ |
175 | pub mod cell; |
176 | pub mod char; | |
0531ce1d | 177 | pub mod panic; |
1a4d82fc | 178 | pub mod panicking; |
1a4d82fc JJ |
179 | pub mod iter; |
180 | pub mod option; | |
181 | pub mod raw; | |
182 | pub mod result; | |
e9174d1e | 183 | |
1a4d82fc JJ |
184 | pub mod slice; |
185 | pub mod str; | |
186 | pub mod hash; | |
187 | pub mod fmt; | |
2c00a5a8 | 188 | pub mod time; |
85aaf69f | 189 | |
0531ce1d XL |
190 | /* Heap memory allocator trait */ |
191 | #[allow(missing_docs)] | |
192 | pub mod heap; | |
193 | ||
1a4d82fc | 194 | // note: does not need to be public |
5bcae85e | 195 | mod char_private; |
3157f602 | 196 | mod iter_private; |
1a4d82fc | 197 | mod tuple; |
abe05a73 | 198 | mod unit; |
0531ce1d XL |
199 | |
200 | // Pull in the the `coresimd` crate directly into libcore. This is where all the | |
201 | // architecture-specific (and vendor-specific) intrinsics are defined. AKA | |
202 | // things like SIMD and such. Note that the actual source for all this lies in a | |
203 | // different repository, rust-lang-nursery/stdsimd. That's why the setup here is | |
204 | // a bit wonky. | |
205 | #[path = "../stdsimd/coresimd/mod.rs"] | |
206 | #[allow(missing_docs, missing_debug_implementations, dead_code)] | |
207 | #[unstable(feature = "stdsimd", issue = "48556")] | |
208 | #[cfg(not(stage0))] // allow changes to how stdsimd works in stage0 | |
209 | mod coresimd; | |
210 | ||
211 | #[unstable(feature = "stdsimd", issue = "48556")] | |
212 | #[cfg(not(stage0))] | |
213 | pub use coresimd::simd; | |
214 | #[unstable(feature = "stdsimd", issue = "48556")] | |
215 | #[cfg(not(stage0))] | |
216 | pub use coresimd::arch; |