]> git.lizzy.rs Git - rust.git/blob - src/libcore/lib.rs
Rollup merge of #43462 - dhduvall:solaris-libresolv, r=aturon
[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 #![crate_name = "core"]
55 #![stable(feature = "core", since = "1.6.0")]
56 #![crate_type = "rlib"]
57 #![doc(html_logo_url = "https://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 = "https://doc.rust-lang.org/nightly/",
60        html_playground_url = "https://play.rust-lang.org/",
61        issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
62        test(no_crate_inject, attr(deny(warnings))),
63        test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))]
64
65 #![no_core]
66 #![deny(missing_docs)]
67 #![deny(missing_debug_implementations)]
68 #![deny(warnings)]
69
70 #![feature(allow_internal_unstable)]
71 #![feature(asm)]
72 #![feature(associated_type_defaults)]
73 #![feature(cfg_target_feature)]
74 #![feature(cfg_target_has_atomic)]
75 #![feature(concat_idents)]
76 #![feature(const_fn)]
77 #![feature(custom_attribute)]
78 #![feature(fundamental)]
79 #![feature(i128_type)]
80 #![feature(inclusive_range_syntax)]
81 #![feature(intrinsics)]
82 #![feature(lang_items)]
83 #![feature(never_type)]
84 #![feature(no_core)]
85 #![feature(on_unimplemented)]
86 #![feature(optin_builtin_traits)]
87 #![feature(prelude_import)]
88 #![feature(repr_simd, platform_intrinsics)]
89 #![feature(rustc_attrs)]
90 #![feature(specialization)]
91 #![feature(staged_api)]
92 #![feature(unboxed_closures)]
93 #![feature(untagged_unions)]
94 #![feature(unwind_attributes)]
95
96 #[prelude_import]
97 #[allow(unused)]
98 use prelude::v1::*;
99
100 #[macro_use]
101 mod macros;
102
103 #[macro_use]
104 mod internal_macros;
105
106 #[path = "num/int_macros.rs"]
107 #[macro_use]
108 mod int_macros;
109
110 #[path = "num/uint_macros.rs"]
111 #[macro_use]
112 mod uint_macros;
113
114 #[path = "num/isize.rs"] pub mod isize;
115 #[path = "num/i8.rs"]    pub mod i8;
116 #[path = "num/i16.rs"]   pub mod i16;
117 #[path = "num/i32.rs"]   pub mod i32;
118 #[path = "num/i64.rs"]   pub mod i64;
119 #[path = "num/i128.rs"]   pub mod i128;
120
121 #[path = "num/usize.rs"] pub mod usize;
122 #[path = "num/u8.rs"]    pub mod u8;
123 #[path = "num/u16.rs"]   pub mod u16;
124 #[path = "num/u32.rs"]   pub mod u32;
125 #[path = "num/u64.rs"]   pub mod u64;
126 #[path = "num/u128.rs"]   pub mod u128;
127
128 #[path = "num/f32.rs"]   pub mod f32;
129 #[path = "num/f64.rs"]   pub mod f64;
130
131 #[macro_use]
132 pub mod num;
133
134 /* The libcore prelude, not as all-encompassing as the libstd prelude */
135
136 pub mod prelude;
137
138 /* Core modules for ownership management */
139
140 pub mod intrinsics;
141 pub mod mem;
142 pub mod nonzero;
143 pub mod ptr;
144
145 /* Core language traits */
146
147 pub mod marker;
148 pub mod ops;
149 pub mod cmp;
150 pub mod clone;
151 pub mod default;
152 pub mod convert;
153 pub mod borrow;
154
155 /* Core types and methods on primitives */
156
157 pub mod any;
158 pub mod array;
159 pub mod sync;
160 pub mod cell;
161 pub mod char;
162 pub mod panicking;
163 pub mod iter;
164 pub mod option;
165 pub mod raw;
166 pub mod result;
167
168 pub mod slice;
169 pub mod str;
170 pub mod hash;
171 pub mod fmt;
172
173 // note: does not need to be public
174 mod char_private;
175 mod iter_private;
176 mod tuple;