Skip to content

Commit dc60788

Browse files
committed
auto merge of #5660 : brson/rust/doc, r=catamorphism
2 parents 8e9fd72 + 243e601 commit dc60788

File tree

3 files changed

+73
-25
lines changed

3 files changed

+73
-25
lines changed

doc/tutorial.md

+59-23
Original file line numberDiff line numberDiff line change
@@ -2554,26 +2554,65 @@ a hash representing the crate metadata.
25542554

25552555
## The core library
25562556

2557-
The Rust [core] library is the language runtime and contains
2558-
required memory management and task scheduling code as well as a
2559-
number of modules necessary for effective usage of the primitive
2560-
types. Methods on [vectors] and [strings], implementations of most
2561-
comparison and math operators, and pervasive types like [`Option`]
2562-
and [`Result`] live in core.
2563-
2564-
All Rust programs link to the core library and import its contents,
2565-
as if the following were written at the top of the crate.
2566-
2567-
~~~ {.xfail-test}
2568-
extern mod core;
2569-
use core::*;
2570-
~~~
2571-
2572-
[core]: core/index.html
2573-
[vectors]: core/vec.html
2557+
The Rust core library provides runtime features required by the language,
2558+
including the task scheduler and memory allocators, as well as library
2559+
support for Rust built-in types, platform abstractions, and other commonly
2560+
used features.
2561+
2562+
[`core`] includes modules corresponding to each of the integer types, each of
2563+
the floating point types, the [`bool`] type, [tuples], [characters], [strings],
2564+
[vectors], [managed boxes], [owned boxes],
2565+
and unsafe and borrowed [pointers]. Additionally, `core` provides
2566+
some pervasive types ([`option`] and [`result`]),
2567+
[task] creation and [communication] primitives,
2568+
platform abstractions ([`os`] and [`path`]), basic
2569+
I/O abstractions ([`io`]), [containers] like [`hashmap`],
2570+
common traits ([`kinds`], [`ops`], [`cmp`], [`num`],
2571+
[`to_str`], [`clone`]), and complete bindings to the C standard library ([`libc`]).
2572+
2573+
### Core injection and the Rust prelude
2574+
2575+
`core` is imported at the topmost level of every crate by default, as
2576+
if the first line of each crate was
2577+
2578+
extern mod core;
2579+
2580+
This means that the contents of core can be accessed from from any context
2581+
with the `core::` path prefix, as in `use core::vec`, `use core::task::spawn`,
2582+
etc.
2583+
2584+
Additionally, `core` contains a `prelude` module that reexports many of the
2585+
most common core modules, types and traits. The contents of the prelude are
2586+
imported into every *module* by default. Implicitly, all modules behave as if
2587+
they contained the following prologue:
2588+
2589+
use core::prelude::*;
2590+
2591+
[`core`]: core/index.html
2592+
[`bool`]: core/bool.html
2593+
[tuples]: core/tuple.html
2594+
[characters]: core/char.html
25742595
[strings]: core/str.html
2575-
[`Option`]: core/option.html
2576-
[`Result`]: core/result.html
2596+
[vectors]: core/vec.html
2597+
[managed boxes]: core/managed.html
2598+
[owned boxes]: core/owned.html
2599+
[pointers]: core/ptr.html
2600+
[`option`]: core/option.html
2601+
[`result`]: core/result.html
2602+
[task]: core/task.html
2603+
[communication]: core/comm.html
2604+
[`os`]: core/os.html
2605+
[`path`]: core/path.html
2606+
[`io`]: core/io.html
2607+
[containers]: core/container.html
2608+
[`hashmap`]: core/hashmap.html
2609+
[`kinds`]: core/kinds.html
2610+
[`ops`]: core/ops.html
2611+
[`cmp`]: core/cmp.html
2612+
[`num`]: core/num.html
2613+
[`to_str`]: core/to_str.html
2614+
[`clone`]: core/clone.html
2615+
[`libc`]: core/libc.html
25772616

25782617
# What next?
25792618

@@ -2585,10 +2624,7 @@ tutorials on individual topics.
25852624
* [Macros][macros]
25862625
* [The foreign function interface][ffi]
25872626

2588-
There is further documentation on the [wiki], including articles about
2589-
[unit testing] in Rust, [documenting][rustdoc] and [packaging][cargo]
2590-
Rust code, and a discussion of the [attributes] used to apply metadata
2591-
to code.
2627+
There is further documentation on the [wiki].
25922628

25932629
[borrow]: tutorial-borrowed-ptr.html
25942630
[tasks]: tutorial-tasks.html

src/libcore/core.rc

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ etc.
3939

4040
Additionally, `core` contains a `prelude` module that reexports many of the
4141
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
42+
imported into every *module* by default. Implicitly, all modules behave as if
4343
they contained the following prologue:
4444

4545
use core::prelude::*;

src/libcore/libc.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,19 @@
99
// except according to those terms.
1010

1111
/*!
12-
* Bindings for libc.
12+
* Bindings for the C standard library and other platform libraries
13+
*
14+
* This module contains bindings to the C standard library,
15+
* organized into modules by their defining standard.
16+
* Additionally, it contains some assorted platform-specific definitions.
17+
* For convenience, most functions and types are reexported from `core::libc`,
18+
* so `pub use core::libc::*` will import the available
19+
* C bindings as appropriate for the target platform. The exact
20+
* set of functions available are platform specific.
21+
*
22+
* *Note* Rustdoc does not indicate reexports currently. Also, because these
23+
* definitions are platform-specific, some may not
24+
* appear in the generated documentation.
1325
*
1426
* We consider the following specs reasonably normative with respect
1527
* to interoperating with the C standard library (libc/msvcrt):

0 commit comments

Comments
 (0)