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