]> git.proxmox.com Git - rustc.git/blame - src/libcore/lib.rs
Imported Upstream version 1.3.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//!
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
c34b1796 38//! provided by the [rlibc crate](https://crates.io/crates/rlibc).
1a4d82fc
JJ
39//!
40//! * `rust_begin_unwind` - This function takes three arguments, a
9346a6ac 41//! `fmt::Arguments`, a `&str`, and a `u32`. These three arguments dictate
1a4d82fc
JJ
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
c34b1796
AL
49// Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
50#![cfg_attr(stage0, feature(custom_attribute))]
1a4d82fc 51#![crate_name = "core"]
62682a34
SL
52#![unstable(feature = "core",
53 reason = "the libcore library has not yet been scrutinized for \
54 stabilization in terms of structure and naming")]
1a4d82fc
JJ
55#![staged_api]
56#![crate_type = "rlib"]
57#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
62682a34 58 html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
1a4d82fc
JJ
59 html_root_url = "http://doc.rust-lang.org/nightly/",
60 html_playground_url = "http://play.rust-lang.org/")]
c34b1796 61#![doc(test(no_crate_inject))]
1a4d82fc 62
85aaf69f 63#![feature(no_std)]
1a4d82fc 64#![no_std]
85aaf69f 65#![allow(raw_pointer_derive)]
1a4d82fc
JJ
66#![deny(missing_docs)]
67
62682a34
SL
68#![feature(associated_type_defaults)]
69#![feature(intrinsics)]
70#![feature(lang_items)]
85aaf69f 71#![feature(on_unimplemented)]
d9579d0f 72#![feature(simd)]
85aaf69f
SL
73#![feature(staged_api)]
74#![feature(unboxed_closures)]
75#![feature(rustc_attrs)]
c34b1796
AL
76#![feature(optin_builtin_traits)]
77#![feature(fundamental)]
78#![feature(concat_idents)]
79#![feature(reflect)]
80#![feature(custom_attribute)]
62682a34
SL
81#![feature(const_fn)]
82#![feature(allow_internal_unstable)]
85aaf69f 83
1a4d82fc
JJ
84#[macro_use]
85mod macros;
86
c34b1796
AL
87#[macro_use]
88mod cmp_macros;
89
1a4d82fc
JJ
90#[path = "num/float_macros.rs"]
91#[macro_use]
92mod float_macros;
93
94#[path = "num/int_macros.rs"]
95#[macro_use]
96mod int_macros;
97
98#[path = "num/uint_macros.rs"]
99#[macro_use]
100mod uint_macros;
101
1a4d82fc
JJ
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
1a4d82fc
JJ
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
9346a6ac 117#[macro_use]
1a4d82fc
JJ
118pub mod num;
119
120/* The libcore prelude, not as all-encompassing as the libstd prelude */
121
122pub mod prelude;
123
124/* Core modules for ownership management */
125
126pub mod intrinsics;
127pub mod mem;
128pub mod nonzero;
129pub mod ptr;
130
131/* Core language traits */
132
133pub mod marker;
134pub mod ops;
135pub mod cmp;
136pub mod clone;
137pub mod default;
c34b1796 138pub mod convert;
1a4d82fc
JJ
139
140/* Core types and methods on primitives */
141
142pub mod any;
c34b1796 143pub mod array;
1a4d82fc 144pub mod atomic;
1a4d82fc
JJ
145pub mod cell;
146pub mod char;
147pub mod panicking;
1a4d82fc
JJ
148pub mod iter;
149pub mod option;
150pub mod raw;
151pub mod result;
152pub mod simd;
153pub mod slice;
154pub mod str;
155pub mod hash;
156pub mod fmt;
85aaf69f 157
1a4d82fc
JJ
158// note: does not need to be public
159mod tuple;
1a4d82fc 160
c1a9b12d
SL
161// A curious inner-module that's not exported that contains the bindings of core
162// so that compiler-expanded references to `core::$foo` can be resolved within
163// core itself.
164//
165// Note that no crate-defined macros require this module due to the existence of
166// the `$crate` meta variable, only those expansions defined in the compiler
167// require this. This is because the compiler doesn't currently know that it's
168// compiling the core library when it's compiling this library, so it expands
169// all references to `::core::$foo`
1a4d82fc
JJ
170#[doc(hidden)]
171mod core {
c1a9b12d
SL
172 pub use intrinsics; // derive(PartialOrd)
173 pub use fmt; // format_args!
174 pub use clone; // derive(Clone)
175 pub use cmp; // derive(Ord)
176 pub use hash; // derive(Hash)
177 pub use marker; // derive(Copy)
178 pub use option; // iterator protocol
179 pub use iter; // iterator protocol
1a4d82fc 180}