rust/src/libcore/lib.rs

149 lines
4.6 KiB
Rust
Raw Normal View History

2014-04-30 22:05:14 -05:00
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
2014-05-22 11:44:54 -05:00
//! # The Rust Core Library
2014-05-12 23:22:35 -05:00
//!
2014-05-19 23:53:00 -05:00
//! The Rust Core Library is the dependency-free foundation of [The
//! Rust Standard Library](../std/index.html). It is the portable glue
//! between the language and its libraries, defining the intrinsic and
//! primitive building blocks of all Rust code. It links to no
2014-05-20 13:39:40 -05:00
//! upstream libraries, no system libraries, and no libc.
2014-05-19 23:53:00 -05:00
//!
//! The core library is *minimal*: it isn't even aware of heap allocation,
//! nor does it provide concurrency or I/O. These things require
2014-05-20 13:39:40 -05:00
//! platform integration, and this library is platform-agnostic.
2014-05-19 23:53:00 -05:00
//!
//! *It is not recommended to use the core library*. The stable
//! functionality of libcore is reexported from the
//! [standard library](../std/index.html). The composition of this library is
//! subject to change over time; only the interface exposed through libstd is
//! intended to be stable.
//!
//! # How to use the core library
//!
2014-05-20 12:40:14 -05:00
// FIXME: Fill me in with more detail when the interface settles
2014-05-19 23:53:00 -05:00
//! This library is built on the assumption of a few existing symbols:
2014-05-12 23:22:35 -05:00
//!
//! * `memcpy`, `memcmp`, `memset` - These are core memory routines which are
//! often generated by LLVM. Additionally, this library can make explicit
2014-05-19 10:51:16 -05:00
//! calls to these functions. Their signatures are the same as found in C.
//! These functions are often provided by the system libc, but can also be
//! provided by `librlibc` which is distributed with the standard rust
//! distribution.
2014-05-12 23:22:35 -05:00
//!
//! * `rust_begin_unwind` - This function takes three arguments, a
2014-05-19 23:53:00 -05:00
//! `&fmt::Arguments`, a `&str`, and a `uint`. These three arguments dictate
2014-05-12 23:22:35 -05:00
//! the failure message, the file at which failure was invoked, and the line.
//! It is up to consumers of this core library to define this failure
//! function; it is only required to never return.
// Since libcore defines many fundamental lang items, all tests live in a
// separate crate, libcoretest, to avoid bizarre issues.
2014-04-30 22:05:14 -05:00
#![crate_name = "core"]
#![experimental]
2014-04-30 22:05:14 -05:00
#![license = "MIT/ASL2"]
#![crate_type = "rlib"]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2014-07-11 13:21:57 -05:00
html_root_url = "http://doc.rust-lang.org/master/",
html_playground_url = "http://play.rust-lang.org/")]
2014-04-30 22:05:14 -05:00
#![no_std]
#![feature(globs, intrinsics, lang_items, macro_rules, phase)]
#![feature(simd, unsafe_destructor)]
2014-04-30 22:05:14 -05:00
#![deny(missing_doc)]
mod macros;
#[path = "num/float_macros.rs"] mod float_macros;
#[path = "num/int_macros.rs"] mod int_macros;
#[path = "num/uint_macros.rs"] mod uint_macros;
#[path = "num/int.rs"] pub mod int;
#[path = "num/i8.rs"] pub mod i8;
#[path = "num/i16.rs"] pub mod i16;
#[path = "num/i32.rs"] pub mod i32;
#[path = "num/i64.rs"] pub mod i64;
#[path = "num/uint.rs"] pub mod uint;
#[path = "num/u8.rs"] pub mod u8;
#[path = "num/u16.rs"] pub mod u16;
#[path = "num/u32.rs"] pub mod u32;
#[path = "num/u64.rs"] pub mod u64;
#[path = "num/f32.rs"] pub mod f32;
#[path = "num/f64.rs"] pub mod f64;
pub mod num;
/* The libcore prelude, not as all-encompassing as the libstd prelude */
pub mod prelude;
2014-04-30 22:04:56 -05:00
/* Core modules for ownership management */
pub mod intrinsics;
2014-04-30 22:13:05 -05:00
pub mod mem;
2014-04-30 22:17:50 -05:00
pub mod ptr;
2014-04-30 22:22:55 -05:00
/* Core language traits */
pub mod kinds;
pub mod ops;
pub mod cmp;
2014-04-30 22:55:38 -05:00
pub mod clone;
2014-04-30 22:46:51 -05:00
pub mod default;
pub mod collections;
2014-04-30 22:33:08 -05:00
std: Stabilize unit, bool, ty, tuple, arc, any This commit applies stability attributes to the contents of these modules, summarized here: * The `unit` and `bool` modules have become #[unstable] as they are purely meant for documentation purposes and are candidates for removal. * The `ty` module has been deprecated, and the inner `Unsafe` type has been renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field has been removed as the compiler now always infers `UnsafeCell` to be invariant. The `new` method i stable, but the `value` field, `get` and `unwrap` methods are all unstable. * The `tuple` module has its name as stable, the naming of the `TupleN` traits as stable while the methods are all #[unstable]. The other impls in the module have appropriate stability for the corresponding trait. * The `arc` module has received the exact same treatment as the `rc` module previously did. * The `any` module has its name as stable. The `Any` trait is also stable, with a new private supertrait which now contains the `get_type_id` method. This is to make the method a private implementation detail rather than a public-facing detail. The two extension traits in the module are marked #[unstable] as they will not be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods have been renamed to downcast_{mut,ref} and are #[unstable]. The extension trait `BoxAny` has been clarified as to why it is unstable as it will not be necessary with DST. This is a breaking change because the `marker1` field was removed from the `UnsafeCell` type. To deal with this change, you can simply delete the field and only specify the value of the `data` field in static initializers. [breaking-change]
2014-07-23 21:10:12 -05:00
#[deprecated = "all functionality now lives in `std::cell`"]
/// Deprecated module in favor of `std::cell`
pub mod ty {
#[deprecated = "this type has been renamed to `UnsafeCell`"]
pub use cell::UnsafeCell as Unsafe;
std: Stabilize unit, bool, ty, tuple, arc, any This commit applies stability attributes to the contents of these modules, summarized here: * The `unit` and `bool` modules have become #[unstable] as they are purely meant for documentation purposes and are candidates for removal. * The `ty` module has been deprecated, and the inner `Unsafe` type has been renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field has been removed as the compiler now always infers `UnsafeCell` to be invariant. The `new` method i stable, but the `value` field, `get` and `unwrap` methods are all unstable. * The `tuple` module has its name as stable, the naming of the `TupleN` traits as stable while the methods are all #[unstable]. The other impls in the module have appropriate stability for the corresponding trait. * The `arc` module has received the exact same treatment as the `rc` module previously did. * The `any` module has its name as stable. The `Any` trait is also stable, with a new private supertrait which now contains the `get_type_id` method. This is to make the method a private implementation detail rather than a public-facing detail. The two extension traits in the module are marked #[unstable] as they will not be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods have been renamed to downcast_{mut,ref} and are #[unstable]. The extension trait `BoxAny` has been clarified as to why it is unstable as it will not be necessary with DST. This is a breaking change because the `marker1` field was removed from the `UnsafeCell` type. To deal with this change, you can simply delete the field and only specify the value of the `data` field in static initializers. [breaking-change]
2014-07-23 21:10:12 -05:00
}
2014-04-30 22:33:08 -05:00
/* Core types and methods on primitives */
2014-04-30 22:36:58 -05:00
pub mod any;
pub mod atomic;
2014-04-30 23:11:17 -05:00
pub mod bool;
2014-05-01 13:19:56 -05:00
pub mod cell;
pub mod char;
pub mod failure;
2014-04-30 22:34:41 -05:00
pub mod finally;
2014-04-30 23:41:03 -05:00
pub mod iter;
2014-04-30 23:35:56 -05:00
pub mod option;
2014-04-30 22:38:31 -05:00
pub mod raw;
pub mod result;
pub mod simd;
pub mod slice;
pub mod str;
2014-04-30 23:02:13 -05:00
pub mod tuple;
2014-07-01 19:21:15 -05:00
// FIXME #15320: primitive documentation needs top-level modules, this
// should be `core::tuple::unit`.
#[path = "tuple/unit.rs"]
pub mod unit;
pub mod fmt;
#[doc(hidden)]
mod core {
pub use failure;
}
#[doc(hidden)]
mod std {
pub use clone;
pub use cmp;
2014-05-08 17:08:26 -05:00
pub use kinds;
pub use option;
pub use fmt;
}