]> git.lizzy.rs Git - rust.git/blob - src/libcore/lib.rs
4a57417e86a1c0b4c3a8229fa2b7e52ce7c2dc4c
[rust.git] / src / libcore / lib.rs
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 //!
13 //! The Rust Core Library is the dependency-free[^free] foundation of [The
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 //!
19 //! [^free]: Strictly speaking, there are some symbols which are needed but
20 //!          they aren't always necessary.
21 //!
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 //!
26 //! # How to use the core library
27 //!
28 //! Please note that all of these details are currently not considered stable.
29 //!
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
37 //!   provided by the [rlibc crate](https://crates.io/crates/rlibc).
38 //!
39 //! * `rust_begin_panic` - This function takes four arguments, a
40 //!   `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments
41 //!   dictate the panic message, the file at which panic was invoked, and the
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`.
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`.
50
51 // Since libcore defines many fundamental lang items, all tests live in a
52 // separate crate, libcoretest, to avoid bizarre issues.
53
54 #![stable(feature = "core", since = "1.6.0")]
55 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
56        html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
57        html_root_url = "https://doc.rust-lang.org/nightly/",
58        html_playground_url = "https://play.rust-lang.org/",
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))))]
62
63 #![no_core]
64 #![deny(missing_docs)]
65 #![deny(missing_debug_implementations)]
66 #![deny(warnings)]
67
68 #![feature(allow_internal_unstable)]
69 #![feature(asm)]
70 #![feature(associated_type_defaults)]
71 #![feature(cfg_target_feature)]
72 #![feature(cfg_target_has_atomic)]
73 #![feature(concat_idents)]
74 #![feature(const_fn)]
75 #![feature(custom_attribute)]
76 #![feature(fundamental)]
77 #![feature(i128_type)]
78 #![feature(inclusive_range_syntax)]
79 #![feature(intrinsics)]
80 #![feature(lang_items)]
81 #![feature(never_type)]
82 #![feature(no_core)]
83 #![feature(on_unimplemented)]
84 #![feature(optin_builtin_traits)]
85 #![feature(prelude_import)]
86 #![feature(repr_simd, platform_intrinsics)]
87 #![feature(rustc_attrs)]
88 #![feature(rustc_const_unstable)]
89 #![feature(specialization)]
90 #![feature(staged_api)]
91 #![feature(unboxed_closures)]
92 #![feature(untagged_unions)]
93 #![feature(unwind_attributes)]
94 #![feature(const_min_value)]
95 #![feature(const_max_value)]
96 #![feature(const_atomic_bool_new)]
97 #![feature(const_atomic_isize_new)]
98 #![feature(const_atomic_usize_new)]
99 #![feature(const_atomic_i8_new)]
100 #![feature(const_atomic_u8_new)]
101 #![feature(const_atomic_i16_new)]
102 #![feature(const_atomic_u16_new)]
103 #![feature(const_atomic_i32_new)]
104 #![feature(const_atomic_u32_new)]
105 #![feature(const_atomic_i64_new)]
106 #![feature(const_atomic_u64_new)]
107 #![feature(const_unsafe_cell_new)]
108 #![feature(const_cell_new)]
109 #![feature(const_nonzero_new)]
110
111 #[prelude_import]
112 #[allow(unused)]
113 use prelude::v1::*;
114
115 #[macro_use]
116 mod macros;
117
118 #[macro_use]
119 mod internal_macros;
120
121 #[path = "num/int_macros.rs"]
122 #[macro_use]
123 mod int_macros;
124
125 #[path = "num/uint_macros.rs"]
126 #[macro_use]
127 mod uint_macros;
128
129 #[path = "num/isize.rs"] pub mod isize;
130 #[path = "num/i8.rs"]    pub mod i8;
131 #[path = "num/i16.rs"]   pub mod i16;
132 #[path = "num/i32.rs"]   pub mod i32;
133 #[path = "num/i64.rs"]   pub mod i64;
134 #[path = "num/i128.rs"]   pub mod i128;
135
136 #[path = "num/usize.rs"] pub mod usize;
137 #[path = "num/u8.rs"]    pub mod u8;
138 #[path = "num/u16.rs"]   pub mod u16;
139 #[path = "num/u32.rs"]   pub mod u32;
140 #[path = "num/u64.rs"]   pub mod u64;
141 #[path = "num/u128.rs"]   pub mod u128;
142
143 #[path = "num/f32.rs"]   pub mod f32;
144 #[path = "num/f64.rs"]   pub mod f64;
145
146 #[macro_use]
147 pub mod num;
148
149 /* The libcore prelude, not as all-encompassing as the libstd prelude */
150
151 pub mod prelude;
152
153 /* Core modules for ownership management */
154
155 pub mod intrinsics;
156 pub mod mem;
157 pub mod nonzero;
158 pub mod ptr;
159
160 /* Core language traits */
161
162 pub mod marker;
163 pub mod ops;
164 pub mod cmp;
165 pub mod clone;
166 pub mod default;
167 pub mod convert;
168 pub mod borrow;
169
170 /* Core types and methods on primitives */
171
172 pub mod any;
173 pub mod array;
174 pub mod sync;
175 pub mod cell;
176 pub mod char;
177 pub mod panicking;
178 pub mod iter;
179 pub mod option;
180 pub mod raw;
181 pub mod result;
182
183 pub mod slice;
184 pub mod str;
185 pub mod hash;
186 pub mod fmt;
187
188 // note: does not need to be public
189 mod char_private;
190 mod iter_private;
191 mod tuple;
192 mod unit;