]> git.lizzy.rs Git - rust.git/blob - src/libcore/lib.rs
9dfaec0095a5a6e648799f7ceae90c9826aecd3d
[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 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 //! The core library is *minimal*: it isn't even aware of heap allocation,
20 //! nor does it provide concurrency or I/O. These things require
21 //! platform integration, and this library is platform-agnostic.
22 //!
23 //! *It is not recommended to use the core library*. The stable
24 //! functionality of libcore is reexported from the
25 //! [standard library](../std/index.html). The composition of this library is
26 //! subject to change over time; only the interface exposed through libstd is
27 //! intended to be stable.
28 //!
29 //! # How to use the core library
30 //!
31 // FIXME: Fill me in with more detail when the interface settles
32 //! This library is built on the assumption of a few existing symbols:
33 //!
34 //! * `memcpy`, `memcmp`, `memset` - These are core memory routines which are
35 //!   often generated by LLVM. Additionally, this library can make explicit
36 //!   calls to these functions. Their signatures are the same as found in C.
37 //!   These functions are often provided by the system libc, but can also be
38 //!   provided by the [rlibc crate](https://crates.io/crates/rlibc).
39 //!
40 //! * `rust_begin_unwind` - This function takes three arguments, a
41 //!   `fmt::Arguments`, a `&str`, and a `u32`. These three arguments dictate
42 //!   the panic message, the file at which panic was invoked, and the line.
43 //!   It is up to consumers of this core library to define this panic
44 //!   function; it is only required to never return.
45
46 // Since libcore defines many fundamental lang items, all tests live in a
47 // separate crate, libcoretest, to avoid bizarre issues.
48
49 // Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
50 #![cfg_attr(stage0, feature(custom_attribute))]
51 #![crate_name = "core"]
52 #![unstable(feature = "core")]
53 #![staged_api]
54 #![crate_type = "rlib"]
55 #![doc(html_logo_url = "http://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 = "http://doc.rust-lang.org/nightly/",
58        html_playground_url = "http://play.rust-lang.org/")]
59 #![doc(test(no_crate_inject))]
60
61 #![feature(no_std)]
62 #![no_std]
63 #![allow(raw_pointer_derive)]
64 #![deny(missing_docs)]
65
66 #![feature(intrinsics, lang_items)]
67 #![feature(on_unimplemented)]
68 #![feature(simd)]
69 #![feature(staged_api)]
70 #![feature(unboxed_closures)]
71 #![feature(rustc_attrs)]
72 #![feature(optin_builtin_traits)]
73 #![feature(fundamental)]
74 #![feature(concat_idents)]
75 #![feature(reflect)]
76 #![feature(custom_attribute)]
77 #![feature(const_fn)]
78
79 #[macro_use]
80 mod macros;
81
82 #[macro_use]
83 mod cmp_macros;
84
85 #[path = "num/float_macros.rs"]
86 #[macro_use]
87 mod float_macros;
88
89 #[path = "num/int_macros.rs"]
90 #[macro_use]
91 mod int_macros;
92
93 #[path = "num/uint_macros.rs"]
94 #[macro_use]
95 mod uint_macros;
96
97 #[path = "num/isize.rs"]  pub mod isize;
98 #[path = "num/i8.rs"]   pub mod i8;
99 #[path = "num/i16.rs"]  pub mod i16;
100 #[path = "num/i32.rs"]  pub mod i32;
101 #[path = "num/i64.rs"]  pub mod i64;
102
103 #[path = "num/usize.rs"] pub mod usize;
104 #[path = "num/u8.rs"]   pub mod u8;
105 #[path = "num/u16.rs"]  pub mod u16;
106 #[path = "num/u32.rs"]  pub mod u32;
107 #[path = "num/u64.rs"]  pub mod u64;
108
109 #[path = "num/f32.rs"]   pub mod f32;
110 #[path = "num/f64.rs"]   pub mod f64;
111
112 #[macro_use]
113 pub mod num;
114
115 /* The libcore prelude, not as all-encompassing as the libstd prelude */
116
117 pub mod prelude;
118
119 /* Core modules for ownership management */
120
121 pub mod intrinsics;
122 pub mod mem;
123 pub mod nonzero;
124 pub mod ptr;
125
126 /* Core language traits */
127
128 pub mod marker;
129 pub mod ops;
130 pub mod cmp;
131 pub mod clone;
132 pub mod default;
133 pub mod convert;
134
135 /* Core types and methods on primitives */
136
137 pub mod any;
138 pub mod array;
139 pub mod atomic;
140 pub mod cell;
141 pub mod char;
142 pub mod panicking;
143 pub mod iter;
144 pub mod option;
145 pub mod raw;
146 pub mod result;
147 pub mod simd;
148 pub mod slice;
149 pub mod str;
150 pub mod hash;
151 pub mod fmt;
152
153 #[doc(primitive = "bool")]
154 mod bool {
155 }
156
157 // note: does not need to be public
158 mod tuple;
159
160 #[doc(hidden)]
161 mod core {
162     pub use intrinsics;
163     pub use panicking;
164     pub use fmt;
165     pub use clone;
166     pub use cmp;
167     pub use hash;
168     pub use marker;
169     pub use option;
170     pub use iter;
171 }
172
173 #[doc(hidden)]
174 mod std {
175     // range syntax
176     pub use ops;
177 }