]> git.proxmox.com Git - rustc.git/blob - src/libcore/lib.rs
Imported Upstream version 1.2.0+dfsg1
[rustc.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 reason = "the libcore library has not yet been scrutinized for \
54 stabilization in terms of structure and naming")]
55 #![staged_api]
56 #![crate_type = "rlib"]
57 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
58 html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
59 html_root_url = "http://doc.rust-lang.org/nightly/",
60 html_playground_url = "http://play.rust-lang.org/")]
61 #![doc(test(no_crate_inject))]
62
63 #![feature(no_std)]
64 #![no_std]
65 #![allow(raw_pointer_derive)]
66 #![deny(missing_docs)]
67
68 #![feature(associated_type_defaults)]
69 #![feature(intrinsics)]
70 #![feature(lang_items)]
71 #![feature(on_unimplemented)]
72 #![feature(simd)]
73 #![feature(staged_api)]
74 #![feature(unboxed_closures)]
75 #![feature(rustc_attrs)]
76 #![feature(optin_builtin_traits)]
77 #![feature(fundamental)]
78 #![feature(concat_idents)]
79 #![feature(reflect)]
80 #![feature(custom_attribute)]
81 #![feature(const_fn)]
82 #![feature(allow_internal_unstable)]
83
84 #[macro_use]
85 mod macros;
86
87 #[macro_use]
88 mod cmp_macros;
89
90 #[path = "num/float_macros.rs"]
91 #[macro_use]
92 mod float_macros;
93
94 #[path = "num/int_macros.rs"]
95 #[macro_use]
96 mod int_macros;
97
98 #[path = "num/uint_macros.rs"]
99 #[macro_use]
100 mod uint_macros;
101
102 #[path = "num/isize.rs"] pub mod isize;
103 #[path = "num/i8.rs"] pub mod i8;
104 #[path = "num/i16.rs"] pub mod i16;
105 #[path = "num/i32.rs"] pub mod i32;
106 #[path = "num/i64.rs"] pub mod i64;
107
108 #[path = "num/usize.rs"] pub mod usize;
109 #[path = "num/u8.rs"] pub mod u8;
110 #[path = "num/u16.rs"] pub mod u16;
111 #[path = "num/u32.rs"] pub mod u32;
112 #[path = "num/u64.rs"] pub mod u64;
113
114 #[path = "num/f32.rs"] pub mod f32;
115 #[path = "num/f64.rs"] pub mod f64;
116
117 #[macro_use]
118 pub mod num;
119
120 /* The libcore prelude, not as all-encompassing as the libstd prelude */
121
122 pub mod prelude;
123
124 /* Core modules for ownership management */
125
126 pub mod intrinsics;
127 pub mod mem;
128 pub mod nonzero;
129 pub mod ptr;
130
131 /* Core language traits */
132
133 pub mod marker;
134 pub mod ops;
135 pub mod cmp;
136 pub mod clone;
137 pub mod default;
138 pub mod convert;
139
140 /* Core types and methods on primitives */
141
142 pub mod any;
143 pub mod array;
144 pub mod atomic;
145 pub mod cell;
146 pub mod char;
147 pub mod panicking;
148 pub mod iter;
149 pub mod option;
150 pub mod raw;
151 pub mod result;
152 pub mod simd;
153 pub mod slice;
154 pub mod str;
155 pub mod hash;
156 pub mod fmt;
157
158 #[doc(primitive = "bool")]
159 mod bool {
160 }
161
162 // note: does not need to be public
163 mod tuple;
164
165 #[doc(hidden)]
166 mod core {
167 pub use intrinsics;
168 pub use panicking;
169 pub use fmt;
170 pub use clone;
171 pub use cmp;
172 pub use hash;
173 pub use marker;
174 pub use option;
175 pub use iter;
176 }
177
178 #[doc(hidden)]
179 mod std {
180 // range syntax
181 pub use ops;
182 }