Skip to content

Commit bbc4ca1

Browse files
committed
auto merge of #5532 : brson/rust/coredocs, r=brson
r?
2 parents d96bbb9 + e5f8026 commit bbc4ca1

File tree

8 files changed

+54
-17
lines changed

8 files changed

+54
-17
lines changed

src/libcore/cast.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
//! Unsafe casting functions
12+
1113
pub mod rusti {
1214
#[abi = "rust-intrinsic"]
1315
#[link_name = "rusti"]

src/libcore/cell.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
//! A mutable, nullable memory location
12+
1113
use cast::transmute;
1214
use option;
1315
use prelude::*;
1416

15-
/// A dynamic, mutable location.
16-
///
17-
/// Similar to a mutable option type, but friendlier.
17+
/*
18+
A dynamic, mutable location.
19+
20+
Similar to a mutable option type, but friendlier.
21+
*/
1822

1923
pub struct Cell<T> {
2024
mut value: Option<T>

src/libcore/clone.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,20 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
/**
12-
Clonable types are copied with the clone method
11+
/*! The Clone trait for types that cannot be "implicitly copied"
12+
13+
In Rust, some simple types are "implicitly copyable" and when you
14+
assign them or pass them as arguments, the receiver will get a copy,
15+
leaving the original value in place. These types do not require
16+
allocation to copy and do not have finalizers (i.e. they do not
17+
contain owned pointers or implement `Drop`), so the compiler considers
18+
them cheap and safe to copy and automatically implements the `Copy`
19+
trait for them. For other types copies must be made explicitly,
20+
by convention implementing the `Clone` trait and calling the
21+
`clone` method.
22+
1323
*/
24+
1425
pub trait Clone {
1526
fn clone(&self) -> Self;
1627
}

src/libcore/comm.rs

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
/*!
12+
Message passing
13+
*/
14+
1115
use cast;
1216
use either::{Either, Left, Right};
1317
use kinds::Owned;

src/libcore/condition.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
/*! Condition handling */
12+
1113
use prelude::*;
1214
use task;
1315
use task::local_data::{local_data_pop, local_data_set};

src/libcore/core.rc

+23-11
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,39 @@
1010

1111
/*!
1212

13-
The Rust core library
13+
# The Rust core library
1414

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

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

29-
`core` is linked to all crates by default and its contents imported.
30-
Implicitly, all crates behave as if they included the following prologue:
29+
# Core injection and the Rust prelude
30+
31+
`core` is imported at the topmost level of every crate by default, as
32+
if the first line of each crate was
3133

3234
extern mod core;
33-
use core::*;
35+
36+
This means that the contents of core can be accessed from from any context
37+
with the `core::` path prefix, as in `use core::vec`, `use core::task::spawn`,
38+
etc.
39+
40+
Additionally, `core` contains a `prelude` module that reexports many of the
41+
most common core modules, types and traits. The contents of the prelude are
42+
imported inte every *module* by default. Implicitly, all modules behave as if
43+
they contained the following prologue:
44+
45+
use core::prelude::*;
3446

3547
*/
3648

src/libcore/prelude.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// This file is imported into every module by default.
11+
//! The Rust prelude. Imported into every module by default.
1212
1313
/* Reexported core operators */
1414

src/libcore/rt/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#[doc(hidden)];
12+
1113
use libc::c_char;
1214

1315
// Some basic logging

0 commit comments

Comments
 (0)