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