Skip to content

Commit

Permalink
auto merge of #5532 : brson/rust/coredocs, r=brson
Browse files Browse the repository at this point in the history
r?
  • Loading branch information
bors committed Mar 26, 2013
2 parents d96bbb9 + e5f8026 commit bbc4ca1
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/libcore/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! Unsafe casting functions

pub mod rusti {
#[abi = "rust-intrinsic"]
#[link_name = "rusti"]
Expand Down
10 changes: 7 additions & 3 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! A mutable, nullable memory location

use cast::transmute;
use option;
use prelude::*;

/// A dynamic, mutable location.
///
/// Similar to a mutable option type, but friendlier.
/*
A dynamic, mutable location.
Similar to a mutable option type, but friendlier.
*/

pub struct Cell<T> {
mut value: Option<T>
Expand Down
15 changes: 13 additions & 2 deletions src/libcore/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,20 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

/**
Clonable types are copied with the clone method
/*! The Clone trait for types that cannot be "implicitly copied"
In Rust, some simple types are "implicitly copyable" and when you
assign them or pass them as arguments, the receiver will get a copy,
leaving the original value in place. These types do not require
allocation to copy and do not have finalizers (i.e. they do not
contain owned pointers or implement `Drop`), so the compiler considers
them cheap and safe to copy and automatically implements the `Copy`
trait for them. For other types copies must be made explicitly,
by convention implementing the `Clone` trait and calling the
`clone` method.
*/

pub trait Clone {
fn clone(&self) -> Self;
}
Expand Down
4 changes: 4 additions & 0 deletions src/libcore/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

/*!
Message passing
*/

use cast;
use either::{Either, Left, Right};
use kinds::Owned;
Expand Down
2 changes: 2 additions & 0 deletions src/libcore/condition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

/*! Condition handling */

use prelude::*;
use task;
use task::local_data::{local_data_pop, local_data_set};
Expand Down
34 changes: 23 additions & 11 deletions src/libcore/core.rc
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,39 @@

/*!

The Rust core library
# The Rust core library

The Rust core library provides runtime features required by the language,
including the task scheduler and memory allocators, as well as library
support for Rust built-in types, platform abstractions, and other commonly
used features.

`core` includes modules corresponding to each of the integer types, each of
the floating point types, the `bool` type, tuples, characters, strings,
vectors (`vec`), managed boxes (`managed`), owned boxes (`owned`), and unsafe
and borrowed pointers (`ptr`). Additionally, `core` provides task management
and creation (`task`), communication primitives (`comm` and `pipes`), platform
abstractions (`os` and `path`), basic I/O abstractions (`io`), common traits
(`cmp`, `num`, `to_str`), and complete bindings to the C standard library
(`libc`).
the floating point types, the `bool` type, tuples, characters, strings
(`str`), vectors (`vec`), managed boxes (`managed`), owned boxes (`owned`),
and unsafe and borrowed pointers (`ptr`). Additionally, `core` provides
pervasive types (`option` and `result`), task creation and communication
primitives (`task`, `comm`), platform abstractions (`os` and `path`), basic
I/O abstractions (`io`), common traits (`kinds`, `ops`, `cmp`, `num`,
`to_str`), and complete bindings to the C standard library (`libc`).

`core` is linked to all crates by default and its contents imported.
Implicitly, all crates behave as if they included the following prologue:
# Core injection and the Rust prelude

`core` is imported at the topmost level of every crate by default, as
if the first line of each crate was

extern mod core;
use core::*;

This means that the contents of core can be accessed from from any context
with the `core::` path prefix, as in `use core::vec`, `use core::task::spawn`,
etc.

Additionally, `core` contains a `prelude` module that reexports many of the
most common core modules, types and traits. The contents of the prelude are
imported inte every *module* by default. Implicitly, all modules behave as if
they contained the following prologue:

use core::prelude::*;

*/

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// This file is imported into every module by default.
//! The Rust prelude. Imported into every module by default.

/* Reexported core operators */

Expand Down
2 changes: 2 additions & 0 deletions src/libcore/rt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[doc(hidden)];

use libc::c_char;

// Some basic logging
Expand Down

0 comments on commit bbc4ca1

Please sign in to comment.