]> git.proxmox.com Git - rustc.git/blame - src/libcore/lib.rs
New upstream version 1.17.0+dfsg2
[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//!
1a4d82fc
JJ
26//! # How to use the core library
27//!
5bcae85e
SL
28//! Please note that all of these details are currently not considered stable.
29//!
1a4d82fc
JJ
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
c34b1796 37//! provided by the [rlibc crate](https://crates.io/crates/rlibc).
1a4d82fc 38//!
5bcae85e
SL
39//! * `rust_begin_panic` - This function takes three arguments, a
40//! `fmt::Arguments`, a `&'static str`, and a `u32`. These three arguments
41//! dictate the panic message, the file at which panic was invoked, and the
42//! line. It is up to consumers of this core library to define this panic
43//! function; it is only required to never return. This requires a `lang`
44//! attribute named `panic_fmt`.
9e0c209e
SL
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`.
1a4d82fc
JJ
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"]
92a42be0 55#![stable(feature = "core", since = "1.6.0")]
1a4d82fc 56#![crate_type = "rlib"]
e9174d1e 57#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
62682a34 58 html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
e9174d1e
SL
59 html_root_url = "https://doc.rust-lang.org/nightly/",
60 html_playground_url = "https://play.rust-lang.org/",
92a42be0
SL
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))))]
1a4d82fc 64
e9174d1e 65#![no_core]
1a4d82fc 66#![deny(missing_docs)]
54a0048b 67#![deny(missing_debug_implementations)]
32a655c1 68#![deny(warnings)]
1a4d82fc 69
e9174d1e 70#![feature(allow_internal_unstable)]
a7813a04 71#![feature(asm)]
62682a34 72#![feature(associated_type_defaults)]
a7813a04 73#![feature(cfg_target_feature)]
e9174d1e
SL
74#![feature(concat_idents)]
75#![feature(const_fn)]
a7813a04 76#![feature(cfg_target_has_atomic)]
e9174d1e
SL
77#![feature(custom_attribute)]
78#![feature(fundamental)]
54a0048b 79#![feature(inclusive_range_syntax)]
62682a34
SL
80#![feature(intrinsics)]
81#![feature(lang_items)]
e9174d1e 82#![feature(no_core)]
85aaf69f 83#![feature(on_unimplemented)]
c34b1796 84#![feature(optin_builtin_traits)]
e9174d1e 85#![feature(unwind_attributes)]
9cc50fc6 86#![feature(repr_simd, platform_intrinsics)]
54a0048b
SL
87#![feature(rustc_attrs)]
88#![feature(specialization)]
e9174d1e
SL
89#![feature(staged_api)]
90#![feature(unboxed_closures)]
9e0c209e 91#![feature(never_type)]
8bb4bdeb 92#![feature(i128_type)]
9e0c209e 93#![feature(prelude_import)]
85aaf69f 94
9e0c209e
SL
95#[prelude_import]
96#[allow(unused)]
97use prelude::v1::*;
5bcae85e 98
1a4d82fc
JJ
99#[macro_use]
100mod macros;
101
c30ab7b3
SL
102#[macro_use]
103mod internal_macros;
104
1a4d82fc
JJ
105#[path = "num/float_macros.rs"]
106#[macro_use]
107mod float_macros;
108
109#[path = "num/int_macros.rs"]
110#[macro_use]
111mod int_macros;
112
113#[path = "num/uint_macros.rs"]
114#[macro_use]
115mod uint_macros;
116
5bcae85e
SL
117#[path = "num/isize.rs"] pub mod isize;
118#[path = "num/i8.rs"] pub mod i8;
119#[path = "num/i16.rs"] pub mod i16;
120#[path = "num/i32.rs"] pub mod i32;
121#[path = "num/i64.rs"] pub mod i64;
32a655c1
SL
122#[path = "num/i128.rs"] pub mod i128;
123
1a4d82fc 124#[path = "num/usize.rs"] pub mod usize;
5bcae85e
SL
125#[path = "num/u8.rs"] pub mod u8;
126#[path = "num/u16.rs"] pub mod u16;
127#[path = "num/u32.rs"] pub mod u32;
128#[path = "num/u64.rs"] pub mod u64;
32a655c1
SL
129#[path = "num/u128.rs"] pub mod u128;
130
1a4d82fc
JJ
131#[path = "num/f32.rs"] pub mod f32;
132#[path = "num/f64.rs"] pub mod f64;
133
9346a6ac 134#[macro_use]
1a4d82fc
JJ
135pub mod num;
136
137/* The libcore prelude, not as all-encompassing as the libstd prelude */
138
139pub mod prelude;
140
141/* Core modules for ownership management */
142
143pub mod intrinsics;
144pub mod mem;
145pub mod nonzero;
146pub mod ptr;
147
148/* Core language traits */
149
150pub mod marker;
151pub mod ops;
152pub mod cmp;
153pub mod clone;
154pub mod default;
c34b1796 155pub mod convert;
e9174d1e 156pub mod borrow;
1a4d82fc
JJ
157
158/* Core types and methods on primitives */
159
160pub mod any;
c34b1796 161pub mod array;
e9174d1e 162pub mod sync;
1a4d82fc
JJ
163pub mod cell;
164pub mod char;
165pub mod panicking;
1a4d82fc
JJ
166pub mod iter;
167pub mod option;
168pub mod raw;
169pub mod result;
e9174d1e 170
1a4d82fc
JJ
171pub mod slice;
172pub mod str;
173pub mod hash;
174pub mod fmt;
85aaf69f 175
1a4d82fc 176// note: does not need to be public
5bcae85e 177mod char_private;
3157f602 178mod iter_private;
1a4d82fc 179mod tuple;