Skip to content

Commit cbc6a11

Browse files
committed
---
yaml --- r: 207999 b: refs/heads/snap-stage3 c: 9f50d62 h: refs/heads/master i: 207997: 7c2b3c3 207995: 25f558f 207991: 0c91c77 207983: e86253f 207967: 864057c 207935: f66a935 207871: db5c917 v: v3
1 parent 5e9c789 commit cbc6a11

39 files changed

+396
-235
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 38a97becdf3e6a6157f6f7ec2d98ade8d8edc193
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: c62c908f083ae5cc1fa914bba9837db054995450
4+
refs/heads/snap-stage3: 9f50d62200a4d495ade0c26f809f0b0c63726e89
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/doc/reference.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,21 +2044,21 @@ A complete list of the built-in language items will be added in the future.
20442044

20452045
### Inline attributes
20462046

2047-
The inline attribute is used to suggest to the compiler to perform an inline
2048-
expansion and place a copy of the function or static in the caller rather than
2049-
generating code to call the function or access the static where it is defined.
2047+
The inline attribute suggests that the compiler should place a copy of
2048+
the function or static in the caller, rather than generating code to
2049+
call the function or access the static where it is defined.
20502050

20512051
The compiler automatically inlines functions based on internal heuristics.
2052-
Incorrectly inlining functions can actually making the program slower, so it
2052+
Incorrectly inlining functions can actually make the program slower, so it
20532053
should be used with care.
20542054

20552055
Immutable statics are always considered inlineable unless marked with
20562056
`#[inline(never)]`. It is undefined whether two different inlineable statics
20572057
have the same memory address. In other words, the compiler is free to collapse
20582058
duplicate inlineable statics together.
20592059

2060-
`#[inline]` and `#[inline(always)]` always causes the function to be serialized
2061-
into crate metadata to allow cross-crate inlining.
2060+
`#[inline]` and `#[inline(always)]` always cause the function to be serialized
2061+
into the crate metadata to allow cross-crate inlining.
20622062

20632063
There are three different types of inline attributes:
20642064

branches/snap-stage3/src/doc/trpl/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ want to dive in with a project, or ‘Syntax and Semantics’ if you prefer to
4040
start small, and learn a single concept thoroughly before moving onto the next.
4141
Copious cross-linking connects these parts together.
4242

43+
### Contributing
44+
45+
The source files from which this book is generated can be found on Github:
46+
[github.com/rust-lang/rust/tree/master/src/doc/trpl](https://github.com/rust-lang/rust/tree/master/src/doc/trpl)
47+
4348
## A brief introduction to Rust
4449

4550
Is Rust a language you might be interested in? Let’s examine a few small code

branches/snap-stage3/src/doc/trpl/error-handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ struct Info {
252252
}
253253

254254
fn write_info(info: &Info) -> io::Result<()> {
255-
let mut file = File::open("my_best_friends.txt").unwrap();
255+
let mut file = File::create("my_best_friends.txt").unwrap();
256256

257257
if let Err(e) = writeln!(&mut file, "name: {}", info.name) {
258258
return Err(e)
@@ -282,7 +282,7 @@ struct Info {
282282
}
283283

284284
fn write_info(info: &Info) -> io::Result<()> {
285-
let mut file = try!(File::open("my_best_friends.txt"));
285+
let mut file = try!(File::create("my_best_friends.txt"));
286286

287287
try!(writeln!(&mut file, "name: {}", info.name));
288288
try!(writeln!(&mut file, "age: {}", info.age));

branches/snap-stage3/src/etc/extract_grammar.py

Lines changed: 0 additions & 156 deletions
This file was deleted.

branches/snap-stage3/src/libcollections/vec.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,43 @@
1515
//!
1616
//! # Examples
1717
//!
18-
//! Explicitly creating a `Vec<T>` with `new()`:
18+
//! You can explicitly create a `Vec<T>` with `new()`:
1919
//!
2020
//! ```
2121
//! let xs: Vec<i32> = Vec::new();
2222
//! ```
2323
//!
24-
//! Using the `vec!` macro:
24+
//! ...or by using the `vec!` macro:
2525
//!
2626
//! ```
2727
//! let ys: Vec<i32> = vec![];
2828
//!
2929
//! let zs = vec![1i32, 2, 3, 4, 5];
3030
//! ```
3131
//!
32-
//! Push:
32+
//! You can `push` values onto the end of a vector (which will grow the vector as needed):
3333
//!
3434
//! ```
3535
//! let mut xs = vec![1i32, 2];
3636
//!
3737
//! xs.push(3);
3838
//! ```
3939
//!
40-
//! And pop:
40+
//! Popping values works in much the same way:
4141
//!
4242
//! ```
4343
//! let mut xs = vec![1i32, 2];
4444
//!
4545
//! let two = xs.pop();
4646
//! ```
47+
//!
48+
//! Vectors also support indexing (through the `Index` and `IndexMut` traits):
49+
//!
50+
//! ```
51+
//! let mut xs = vec![1i32, 2, 3];
52+
//! let three = xs[2];
53+
//! xs[1] = xs[1] + 5;
54+
//! ```
4755
4856
#![stable(feature = "rust1", since = "1.0.0")]
4957

branches/snap-stage3/src/libcore/str/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
136136

137137
/// Converts a slice of bytes to a string slice without checking
138138
/// that the string contains valid UTF-8.
139+
#[inline(always)]
139140
#[stable(feature = "rust1", since = "1.0.0")]
140141
pub unsafe fn from_utf8_unchecked<'a>(v: &'a [u8]) -> &'a str {
141142
mem::transmute(v)

branches/snap-stage3/src/librustc_trans/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ fn add_local_native_libraries(cmd: &mut Command, sess: &Session) {
10781078
sess.target_filesearch(PathKind::All).for_each_lib_search_path(|path, k| {
10791079
match k {
10801080
PathKind::Framework => { cmd.arg("-F").arg(path); }
1081-
_ => { cmd.arg("-L").arg(path); }
1081+
_ => { cmd.arg("-L").arg(&fix_windows_verbatim_for_gcc(path)); }
10821082
}
10831083
FileDoesntMatch
10841084
});

branches/snap-stage3/src/libstd/collections/hash/map.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,9 @@ fn test_resize_policy() {
212212
/// overridden with one of the constructors.
213213
///
214214
/// It is required that the keys implement the `Eq` and `Hash` traits, although
215-
/// this can frequently be achieved by using `#[derive(Eq, Hash)]`. If you
216-
/// implement these yourself, it is important that the following property holds:
215+
/// this can frequently be achieved by using `#[derive(PartialEq, Eq, Hash)]`.
216+
/// If you implement these yourself, it is important that the following
217+
/// property holds:
217218
///
218219
/// ```text
219220
/// k1 == k2 -> hash(k1) == hash(k2)
@@ -250,26 +251,26 @@ fn test_resize_policy() {
250251
/// book_reviews.insert("The Adventures of Sherlock Holmes", "Eye lyked it alot.");
251252
///
252253
/// // check for a specific one.
253-
/// if !book_reviews.contains_key(&("Les Misérables")) {
254+
/// if !book_reviews.contains_key("Les Misérables") {
254255
/// println!("We've got {} reviews, but Les Misérables ain't one.",
255256
/// book_reviews.len());
256257
/// }
257258
///
258259
/// // oops, this review has a lot of spelling mistakes, let's delete it.
259-
/// book_reviews.remove(&("The Adventures of Sherlock Holmes"));
260+
/// book_reviews.remove("The Adventures of Sherlock Holmes");
260261
///
261262
/// // look up the values associated with some keys.
262263
/// let to_find = ["Pride and Prejudice", "Alice's Adventure in Wonderland"];
263-
/// for book in to_find.iter() {
264+
/// for book in &to_find {
264265
/// match book_reviews.get(book) {
265-
/// Some(review) => println!("{}: {}", *book, *review),
266-
/// None => println!("{} is unreviewed.", *book)
266+
/// Some(review) => println!("{}: {}", book, review),
267+
/// None => println!("{} is unreviewed.", book)
267268
/// }
268269
/// }
269270
///
270271
/// // iterate over everything.
271-
/// for (book, review) in book_reviews.iter() {
272-
/// println!("{}: \"{}\"", *book, *review);
272+
/// for (book, review) in &book_reviews {
273+
/// println!("{}: \"{}\"", book, review);
273274
/// }
274275
/// ```
275276
///
@@ -300,7 +301,7 @@ fn test_resize_policy() {
300301
/// vikings.insert(Viking::new("Harald", "Iceland"), 12);
301302
///
302303
/// // Use derived implementation to print the status of the vikings.
303-
/// for (viking, health) in vikings.iter() {
304+
/// for (viking, health) in &vikings {
304305
/// println!("{:?} has {} hp", viking, health);
305306
/// }
306307
/// ```

branches/snap-stage3/src/libstd/collections/hash/set.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ use super::state::HashState;
3131
// to get rid of it properly.
3232

3333
/// An implementation of a hash set using the underlying representation of a
34-
/// HashMap where the value is (). As with the `HashMap` type, a `HashSet`
35-
/// requires that the elements implement the `Eq` and `Hash` traits. This can
36-
/// frequently be achieved by using `#[derive(Eq, Hash)]`. If you implement
37-
/// these yourself, it is important that the following property holds:
34+
/// HashMap where the value is ().
35+
///
36+
/// As with the `HashMap` type, a `HashSet` requires that the elements
37+
/// implement the `Eq` and `Hash` traits. This can frequently be achieved by
38+
/// using `#[derive(PartialEq, Eq, Hash)]`. If you implement these yourself,
39+
/// it is important that the following property holds:
3840
///
3941
/// ```text
4042
/// k1 == k2 -> hash(k1) == hash(k2)
@@ -64,17 +66,17 @@ use super::state::HashState;
6466
/// books.insert("The Great Gatsby");
6567
///
6668
/// // Check for a specific one.
67-
/// if !books.contains(&("The Winds of Winter")) {
69+
/// if !books.contains("The Winds of Winter") {
6870
/// println!("We have {} books, but The Winds of Winter ain't one.",
6971
/// books.len());
7072
/// }
7173
///
7274
/// // Remove a book.
73-
/// books.remove(&"The Odyssey");
75+
/// books.remove("The Odyssey");
7476
///
7577
/// // Iterate over everything.
76-
/// for book in books.iter() {
77-
/// println!("{}", *book);
78+
/// for book in &books {
79+
/// println!("{}", book);
7880
/// }
7981
/// ```
8082
///
@@ -98,7 +100,7 @@ use super::state::HashState;
98100
/// vikings.insert(Viking { name: "Harald", power: 8 });
99101
///
100102
/// // Use derived implementation to print the vikings.
101-
/// for x in vikings.iter() {
103+
/// for x in &vikings {
102104
/// println!("{:?}", x);
103105
/// }
104106
/// ```

0 commit comments

Comments
 (0)