]> git.proxmox.com Git - rustc.git/blob - src/libcore/lib.rs
Imported Upstream version 1.9.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[^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 // FIXME: Fill me in with more detail when the interface settles
29 //! This library is built on the assumption of a few existing symbols:
30 //!
31 //! * `memcpy`, `memcmp`, `memset` - These are core memory routines which are
32 //! often generated by LLVM. Additionally, this library can make explicit
33 //! calls to these functions. Their signatures are the same as found in C.
34 //! These functions are often provided by the system libc, but can also be
35 //! provided by the [rlibc crate](https://crates.io/crates/rlibc).
36 //!
37 //! * `rust_begin_unwind` - This function takes three arguments, a
38 //! `fmt::Arguments`, a `&str`, and a `u32`. These three arguments dictate
39 //! the panic message, the file at which panic was invoked, and the line.
40 //! It is up to consumers of this core library to define this panic
41 //! function; it is only required to never return.
42
43 // Since libcore defines many fundamental lang items, all tests live in a
44 // separate crate, libcoretest, to avoid bizarre issues.
45
46 #![crate_name = "core"]
47 #![stable(feature = "core", since = "1.6.0")]
48 #![crate_type = "rlib"]
49 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
50 html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
51 html_root_url = "https://doc.rust-lang.org/nightly/",
52 html_playground_url = "https://play.rust-lang.org/",
53 issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
54 test(no_crate_inject, attr(deny(warnings))),
55 test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))]
56
57 #![no_core]
58 #![deny(missing_docs)]
59 #![deny(missing_debug_implementations)]
60 #![cfg_attr(not(stage0), deny(warnings))]
61
62 #![feature(allow_internal_unstable)]
63 #![feature(associated_type_defaults)]
64 #![feature(concat_idents)]
65 #![feature(const_fn)]
66 #![feature(custom_attribute)]
67 #![feature(fundamental)]
68 #![feature(inclusive_range_syntax)]
69 #![feature(intrinsics)]
70 #![feature(lang_items)]
71 #![feature(no_core)]
72 #![feature(on_unimplemented)]
73 #![feature(optin_builtin_traits)]
74 #![feature(reflect)]
75 #![feature(unwind_attributes)]
76 #![feature(repr_simd, platform_intrinsics)]
77 #![feature(rustc_attrs)]
78 #![feature(specialization)]
79 #![feature(staged_api)]
80 #![feature(unboxed_closures)]
81 #![feature(question_mark)]
82
83 #[macro_use]
84 mod macros;
85
86 #[path = "num/float_macros.rs"]
87 #[macro_use]
88 mod float_macros;
89
90 #[path = "num/int_macros.rs"]
91 #[macro_use]
92 mod int_macros;
93
94 #[path = "num/uint_macros.rs"]
95 #[macro_use]
96 mod uint_macros;
97
98 #[path = "num/isize.rs"] pub mod isize;
99 #[path = "num/i8.rs"] pub mod i8;
100 #[path = "num/i16.rs"] pub mod i16;
101 #[path = "num/i32.rs"] pub mod i32;
102 #[path = "num/i64.rs"] pub mod i64;
103
104 #[path = "num/usize.rs"] pub mod usize;
105 #[path = "num/u8.rs"] pub mod u8;
106 #[path = "num/u16.rs"] pub mod u16;
107 #[path = "num/u32.rs"] pub mod u32;
108 #[path = "num/u64.rs"] pub mod u64;
109
110 #[path = "num/f32.rs"] pub mod f32;
111 #[path = "num/f64.rs"] pub mod f64;
112
113 #[macro_use]
114 pub mod num;
115
116 /* The libcore prelude, not as all-encompassing as the libstd prelude */
117
118 pub mod prelude;
119
120 /* Core modules for ownership management */
121
122 pub mod intrinsics;
123 pub mod mem;
124 pub mod nonzero;
125 pub mod ptr;
126
127 /* Core language traits */
128
129 pub mod marker;
130 pub mod ops;
131 pub mod cmp;
132 pub mod clone;
133 pub mod default;
134 pub mod convert;
135 pub mod borrow;
136
137 /* Core types and methods on primitives */
138
139 pub mod any;
140 pub mod array;
141 pub mod sync;
142 pub mod cell;
143 pub mod char;
144 pub mod panicking;
145 pub mod iter;
146 pub mod option;
147 pub mod raw;
148 pub mod result;
149
150 pub mod slice;
151 pub mod str;
152 pub mod hash;
153 pub mod fmt;
154
155 // note: does not need to be public
156 mod tuple;