Skip to content

Commit e8d743e

Browse files
committed
rollup merge of #19329: steveklabnik/doc_style_cleanup2
2 parents 60541cd + cd5c823 commit e8d743e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+6858
-8078
lines changed

src/libcollections/hash/mod.rs

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

11-
/*!
12-
* Generic hashing support.
13-
*
14-
* This module provides a generic way to compute the hash of a value. The
15-
* simplest way to make a type hashable is to use `#[deriving(Hash)]`:
16-
*
17-
* # Example
18-
*
19-
* ```rust
20-
* use std::hash;
21-
* use std::hash::Hash;
22-
*
23-
* #[deriving(Hash)]
24-
* struct Person {
25-
* id: uint,
26-
* name: String,
27-
* phone: u64,
28-
* }
29-
*
30-
* let person1 = Person { id: 5, name: "Janet".to_string(), phone: 555_666_7777 };
31-
* let person2 = Person { id: 5, name: "Bob".to_string(), phone: 555_666_7777 };
32-
*
33-
* assert!(hash::hash(&person1) != hash::hash(&person2));
34-
* ```
35-
*
36-
* If you need more control over how a value is hashed, you need to implement
37-
* the trait `Hash`:
38-
*
39-
* ```rust
40-
* use std::hash;
41-
* use std::hash::Hash;
42-
* use std::hash::sip::SipState;
43-
*
44-
* struct Person {
45-
* id: uint,
46-
* name: String,
47-
* phone: u64,
48-
* }
49-
*
50-
* impl Hash for Person {
51-
* fn hash(&self, state: &mut SipState) {
52-
* self.id.hash(state);
53-
* self.phone.hash(state);
54-
* }
55-
* }
56-
*
57-
* let person1 = Person { id: 5, name: "Janet".to_string(), phone: 555_666_7777 };
58-
* let person2 = Person { id: 5, name: "Bob".to_string(), phone: 555_666_7777 };
59-
*
60-
* assert!(hash::hash(&person1) == hash::hash(&person2));
61-
* ```
62-
*/
11+
//! Generic hashing support.
12+
//!
13+
//! This module provides a generic way to compute the hash of a value. The
14+
//! simplest way to make a type hashable is to use `#[deriving(Hash)]`:
15+
//!
16+
//! # Example
17+
//!
18+
//! ```rust
19+
//! use std::hash;
20+
//! use std::hash::Hash;
21+
//!
22+
//! #[deriving(Hash)]
23+
//! struct Person {
24+
//! id: uint,
25+
//! name: String,
26+
//! phone: u64,
27+
//! }
28+
//!
29+
//! let person1 = Person { id: 5, name: "Janet".to_string(), phone: 555_666_7777 };
30+
//! let person2 = Person { id: 5, name: "Bob".to_string(), phone: 555_666_7777 };
31+
//!
32+
//! assert!(hash::hash(&person1) != hash::hash(&person2));
33+
//! ```
34+
//!
35+
//! If you need more control over how a value is hashed, you need to implement
36+
//! the trait `Hash`:
37+
//!
38+
//! ```rust
39+
//! use std::hash;
40+
//! use std::hash::Hash;
41+
//! use std::hash::sip::SipState;
42+
//!
43+
//! struct Person {
44+
//! id: uint,
45+
//! name: String,
46+
//! phone: u64,
47+
//! }
48+
//!
49+
//! impl Hash for Person {
50+
//! fn hash(&self, state: &mut SipState) {
51+
//! self.id.hash(state);
52+
//! self.phone.hash(state);
53+
//! }
54+
//! }
55+
//!
56+
//! let person1 = Person { id: 5, name: "Janet".to_string(), phone: 555_666_7777 };
57+
//! let person2 = Person { id: 5, name: "Bob".to_string(), phone: 555_666_7777 };
58+
//!
59+
//! assert!(hash::hash(&person1) == hash::hash(&person2));
60+
//! ```
6361
6462
#![allow(unused_must_use)]
6563

src/libcore/clone.rs

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

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 boxes or implement `Drop`), so the compiler considers
18-
them cheap and safe to copy. For other types copies must be made
19-
explicitly, by convention implementing the `Clone` trait and calling
20-
the `clone` method.
21-
22-
*/
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 boxes or implement `Drop`), so the compiler considers
18+
//! them cheap and safe to copy. For other types copies must be made
19+
//! explicitly, by convention implementing the `Clone` trait and calling
20+
//! the `clone` method.
2321
2422
#![unstable]
2523

src/libcore/finally.rs

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

11-
/*!
12-
The Finally trait provides a method, `finally` on
13-
stack closures that emulates Java-style try/finally blocks.
14-
15-
Using the `finally` method is sometimes convenient, but the type rules
16-
prohibit any shared, mutable state between the "try" case and the
17-
"finally" case. For advanced cases, the `try_finally` function can
18-
also be used. See that function for more details.
19-
20-
# Example
21-
22-
```
23-
use std::finally::Finally;
24-
25-
(|| {
26-
// ...
27-
}).finally(|| {
28-
// this code is always run
29-
})
30-
```
31-
*/
11+
//! The Finally trait provides a method, `finally` on
12+
//! stack closures that emulates Java-style try/finally blocks.
13+
//!
14+
//! Using the `finally` method is sometimes convenient, but the type rules
15+
//! prohibit any shared, mutable state between the "try" case and the
16+
//! "finally" case. For advanced cases, the `try_finally` function can
17+
//! also be used. See that function for more details.
18+
//!
19+
//! # Example
20+
//!
21+
//! ```
22+
//! use std::finally::Finally;
23+
//!
24+
//! (|| {
25+
//! // ...
26+
//! }).finally(|| {
27+
//! // this code is always run
28+
//! })
29+
//! ```
3230
3331
#![experimental]
3432

src/libcore/intrinsics.rs

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

11-
/*! rustc compiler intrinsics.
12-
13-
The corresponding definitions are in librustc/middle/trans/foreign.rs.
14-
15-
# Volatiles
16-
17-
The volatile intrinsics provide operations intended to act on I/O
18-
memory, which are guaranteed to not be reordered by the compiler
19-
across other volatile intrinsics. See the LLVM documentation on
20-
[[volatile]].
21-
22-
[volatile]: http://llvm.org/docs/LangRef.html#volatile-memory-accesses
23-
24-
# Atomics
25-
26-
The atomic intrinsics provide common atomic operations on machine
27-
words, with multiple possible memory orderings. They obey the same
28-
semantics as C++11. See the LLVM documentation on [[atomics]].
29-
30-
[atomics]: http://llvm.org/docs/Atomics.html
31-
32-
A quick refresher on memory ordering:
33-
34-
* Acquire - a barrier for acquiring a lock. Subsequent reads and writes
35-
take place after the barrier.
36-
* Release - a barrier for releasing a lock. Preceding reads and writes
37-
take place before the barrier.
38-
* Sequentially consistent - sequentially consistent operations are
39-
guaranteed to happen in order. This is the standard mode for working
40-
with atomic types and is equivalent to Java's `volatile`.
41-
42-
*/
11+
//! rustc compiler intrinsics.
12+
//!
13+
//! The corresponding definitions are in librustc/middle/trans/foreign.rs.
14+
//!
15+
//! # Volatiles
16+
//!
17+
//! The volatile intrinsics provide operations intended to act on I/O
18+
//! memory, which are guaranteed to not be reordered by the compiler
19+
//! across other volatile intrinsics. See the LLVM documentation on
20+
//! [[volatile]].
21+
//!
22+
//! [volatile]: http://llvm.org/docs/LangRef.html#volatile-memory-accesses
23+
//!
24+
//! # Atomics
25+
//!
26+
//! The atomic intrinsics provide common atomic operations on machine
27+
//! words, with multiple possible memory orderings. They obey the same
28+
//! semantics as C++11. See the LLVM documentation on [[atomics]].
29+
//!
30+
//! [atomics]: http://llvm.org/docs/Atomics.html
31+
//!
32+
//! A quick refresher on memory ordering:
33+
//!
34+
//! * Acquire - a barrier for acquiring a lock. Subsequent reads and writes
35+
//! take place after the barrier.
36+
//! * Release - a barrier for releasing a lock. Preceding reads and writes
37+
//! take place before the barrier.
38+
//! * Sequentially consistent - sequentially consistent operations are
39+
//! guaranteed to happen in order. This is the standard mode for working
40+
//! with atomic types and is equivalent to Java's `volatile`.
4341
4442
#![experimental]
4543
#![allow(missing_docs)]

src/libcore/iter.rs

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

11-
/*!
12-
13-
Composable external iterators
14-
15-
# The `Iterator` trait
16-
17-
This module defines Rust's core iteration trait. The `Iterator` trait has one
18-
unimplemented method, `next`. All other methods are derived through default
19-
methods to perform operations such as `zip`, `chain`, `enumerate`, and `fold`.
20-
21-
The goal of this module is to unify iteration across all containers in Rust.
22-
An iterator can be considered as a state machine which is used to track which
23-
element will be yielded next.
24-
25-
There are various extensions also defined in this module to assist with various
26-
types of iteration, such as the `DoubleEndedIterator` for iterating in reverse,
27-
the `FromIterator` trait for creating a container from an iterator, and much
28-
more.
29-
30-
## Rust's `for` loop
31-
32-
The special syntax used by rust's `for` loop is based around the `Iterator`
33-
trait defined in this module. For loops can be viewed as a syntactical expansion
34-
into a `loop`, for example, the `for` loop in this example is essentially
35-
translated to the `loop` below.
36-
37-
```rust
38-
let values = vec![1i, 2, 3];
39-
40-
// "Syntactical sugar" taking advantage of an iterator
41-
for &x in values.iter() {
42-
println!("{}", x);
43-
}
44-
45-
// Rough translation of the iteration without a `for` iterator.
46-
let mut it = values.iter();
47-
loop {
48-
match it.next() {
49-
Some(&x) => {
50-
println!("{}", x);
51-
}
52-
None => { break }
53-
}
54-
}
55-
```
56-
57-
This `for` loop syntax can be applied to any iterator over any type.
58-
59-
*/
11+
//! Composable external iterators
12+
//!
13+
//! # The `Iterator` trait
14+
//!
15+
//! This module defines Rust's core iteration trait. The `Iterator` trait has one
16+
//! unimplemented method, `next`. All other methods are derived through default
17+
//! methods to perform operations such as `zip`, `chain`, `enumerate`, and `fold`.
18+
//!
19+
//! The goal of this module is to unify iteration across all containers in Rust.
20+
//! An iterator can be considered as a state machine which is used to track which
21+
//! element will be yielded next.
22+
//!
23+
//! There are various extensions also defined in this module to assist with various
24+
//! types of iteration, such as the `DoubleEndedIterator` for iterating in reverse,
25+
//! the `FromIterator` trait for creating a container from an iterator, and much
26+
//! more.
27+
//!
28+
//! ## Rust's `for` loop
29+
//!
30+
//! The special syntax used by rust's `for` loop is based around the `Iterator`
31+
//! trait defined in this module. For loops can be viewed as a syntactical expansion
32+
//! into a `loop`, for example, the `for` loop in this example is essentially
33+
//! translated to the `loop` below.
34+
//!
35+
//! ```rust
36+
//! let values = vec![1i, 2, 3];
37+
//!
38+
//! // "Syntactical sugar" taking advantage of an iterator
39+
//! for &x in values.iter() {
40+
//! println!("{}", x);
41+
//! }
42+
//!
43+
//! // Rough translation of the iteration without a `for` iterator.
44+
//! let mut it = values.iter();
45+
//! loop {
46+
//! match it.next() {
47+
//! Some(&x) => {
48+
//! println!("{}", x);
49+
//! }
50+
//! None => { break }
51+
//! }
52+
//! }
53+
//! ```
54+
//!
55+
//! This `for` loop syntax can be applied to any iterator over any type.
6056
6157
pub use self::MinMaxResult::*;
6258

src/libcore/kinds.rs

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

11-
/*!
12-
Primitive traits representing basic 'kinds' of types
13-
14-
Rust types can be classified in various useful ways according to
15-
intrinsic properties of the type. These classifications, often called
16-
'kinds', are represented as traits.
17-
18-
They cannot be implemented by user code, but are instead implemented
19-
by the compiler automatically for the types to which they apply.
20-
21-
*/
11+
//! Primitive traits representing basic 'kinds' of types
12+
//!
13+
//! Rust types can be classified in various useful ways according to
14+
//! intrinsic properties of the type. These classifications, often called
15+
//! 'kinds', are represented as traits.
16+
//!
17+
//! They cannot be implemented by user code, but are instead implemented
18+
//! by the compiler automatically for the types to which they apply.
2219
2320
/// Types able to be transferred across task boundaries.
2421
#[lang="send"]

0 commit comments

Comments
 (0)