Skip to content

Commit 5e9c789

Browse files
committed
---
yaml --- r: 207998 b: refs/heads/snap-stage3 c: c62c908 h: refs/heads/master v: v3
1 parent 7c2b3c3 commit 5e9c789

40 files changed

+240
-384
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: 86a858add58168faf42838e9852a0b5b012cd6be
4+
refs/heads/snap-stage3: c62c908f083ae5cc1fa914bba9837db054995450
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 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.
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.
20502050

20512051
The compiler automatically inlines functions based on internal heuristics.
2052-
Incorrectly inlining functions can actually make the program slower, so it
2052+
Incorrectly inlining functions can actually making 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 cause the function to be serialized
2061-
into the crate metadata to allow cross-crate inlining.
2060+
`#[inline]` and `#[inline(always)]` always causes the function to be serialized
2061+
into 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: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ 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-
4843
## A brief introduction to Rust
4944

5045
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::create("my_best_friends.txt").unwrap();
255+
let mut file = File::open("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::create("my_best_friends.txt"));
285+
let mut file = try!(File::open("my_best_friends.txt"));
286286

287287
try!(writeln!(&mut file, "name: {}", info.name));
288288
try!(writeln!(&mut file, "age: {}", info.age));
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
4+
# file at the top-level directory of this distribution and at
5+
# http://rust-lang.org/COPYRIGHT.
6+
#
7+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10+
# option. This file may not be copied, modified, or distributed
11+
# except according to those terms.
12+
13+
# This script is for extracting the grammar from the rust docs.
14+
15+
import fileinput
16+
17+
collections = {"gram": [],
18+
"keyword": [],
19+
"reserved": [],
20+
"binop": [],
21+
"unop": []}
22+
23+
24+
in_coll = False
25+
coll = ""
26+
27+
for line in fileinput.input(openhook=fileinput.hook_encoded("utf-8")):
28+
if in_coll:
29+
if line.startswith("~~~~"):
30+
in_coll = False
31+
else:
32+
if coll in ["keyword", "reserved", "binop", "unop"]:
33+
for word in line.split():
34+
if word not in collections[coll]:
35+
collections[coll].append(word)
36+
else:
37+
collections[coll].append(line)
38+
39+
else:
40+
if line.startswith("~~~~"):
41+
for cname in collections:
42+
if ("." + cname) in line:
43+
coll = cname
44+
in_coll = True
45+
break
46+
47+
# Define operator symbol-names here
48+
49+
tokens = ["non_star", "non_slash", "non_eol",
50+
"non_single_quote", "non_double_quote", "ident"]
51+
52+
symnames = {
53+
".": "dot",
54+
"+": "plus",
55+
"-": "minus",
56+
"/": "slash",
57+
"*": "star",
58+
"%": "percent",
59+
60+
"~": "tilde",
61+
"@": "at",
62+
63+
"!": "not",
64+
"&": "and",
65+
"|": "or",
66+
"^": "xor",
67+
68+
"<<": "lsl",
69+
">>": "lsr",
70+
">>>": "asr",
71+
72+
"&&": "andand",
73+
"||": "oror",
74+
75+
"<": "lt",
76+
"<=": "le",
77+
"==": "eqeq",
78+
">=": "ge",
79+
">": "gt",
80+
81+
"=": "eq",
82+
83+
"+=": "plusequal",
84+
"-=": "minusequal",
85+
"/=": "divequal",
86+
"*=": "starequal",
87+
"%=": "percentequal",
88+
89+
"&=": "andequal",
90+
"|=": "orequal",
91+
"^=": "xorequal",
92+
93+
">>=": "lsrequal",
94+
">>>=": "asrequal",
95+
"<<=": "lslequal",
96+
97+
"::": "coloncolon",
98+
99+
"->": "rightarrow",
100+
"<-": "leftarrow",
101+
"<->": "swaparrow",
102+
103+
"//": "linecomment",
104+
"/*": "openblockcomment",
105+
"*/": "closeblockcomment",
106+
"macro_rules": "macro_rules",
107+
"=>": "eg",
108+
"..": "dotdot",
109+
",": "comma"
110+
}
111+
112+
lines = []
113+
114+
for line in collections["gram"]:
115+
line2 = ""
116+
for word in line.split():
117+
# replace strings with keyword-names or symbol-names from table
118+
if word.startswith("\""):
119+
word = word[1:-1]
120+
if word in symnames:
121+
word = symnames[word]
122+
else:
123+
for ch in word:
124+
if not ch.isalpha():
125+
raise Exception("non-alpha apparent keyword: "
126+
+ word)
127+
if word not in tokens:
128+
if (word in collections["keyword"] or
129+
word in collections["reserved"]):
130+
tokens.append(word)
131+
else:
132+
raise Exception("unknown keyword/reserved word: "
133+
+ word)
134+
135+
line2 += " " + word
136+
lines.append(line2)
137+
138+
139+
for word in collections["keyword"] + collections["reserved"]:
140+
if word not in tokens:
141+
tokens.append(word)
142+
143+
for sym in collections["unop"] + collections["binop"] + symnames.keys():
144+
word = symnames[sym]
145+
if word not in tokens:
146+
tokens.append(word)
147+
148+
149+
print("%start parser, token;")
150+
print("%%token %s ;" % ("\n\t, ".join(tokens)))
151+
for coll in ["keyword", "reserved"]:
152+
print("%s: %s ; " % (coll, "\n\t| ".join(collections[coll])))
153+
for coll in ["binop", "unop"]:
154+
print("%s: %s ; " % (coll, "\n\t| ".join([symnames[x]
155+
for x in collections[coll]])))
156+
print("\n".join(lines))

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,35 @@
1515
//!
1616
//! # Examples
1717
//!
18-
//! You can explicitly create a `Vec<T>` with `new()`:
18+
//! Explicitly creating a `Vec<T>` with `new()`:
1919
//!
2020
//! ```
2121
//! let xs: Vec<i32> = Vec::new();
2222
//! ```
2323
//!
24-
//! ...or by using the `vec!` macro:
24+
//! 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-
//! You can `push` values onto the end of a vector (which will grow the vector as needed):
32+
//! Push:
3333
//!
3434
//! ```
3535
//! let mut xs = vec![1i32, 2];
3636
//!
3737
//! xs.push(3);
3838
//! ```
3939
//!
40-
//! Popping values works in much the same way:
40+
//! And pop:
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-
//! ```
5547
5648
#![stable(feature = "rust1", since = "1.0.0")]
5749

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ 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)]
140139
#[stable(feature = "rust1", since = "1.0.0")]
141140
pub unsafe fn from_utf8_unchecked<'a>(v: &'a [u8]) -> &'a str {
142141
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(&fix_windows_verbatim_for_gcc(path)); }
1081+
_ => { cmd.arg("-L").arg(path); }
10821082
}
10831083
FileDoesntMatch
10841084
});

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,8 @@ 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(PartialEq, Eq, Hash)]`.
216-
/// If you implement these yourself, it is important that the following
217-
/// property holds:
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:
218217
///
219218
/// ```text
220219
/// k1 == k2 -> hash(k1) == hash(k2)
@@ -251,26 +250,26 @@ fn test_resize_policy() {
251250
/// book_reviews.insert("The Adventures of Sherlock Holmes", "Eye lyked it alot.");
252251
///
253252
/// // check for a specific one.
254-
/// if !book_reviews.contains_key("Les Misérables") {
253+
/// if !book_reviews.contains_key(&("Les Misérables")) {
255254
/// println!("We've got {} reviews, but Les Misérables ain't one.",
256255
/// book_reviews.len());
257256
/// }
258257
///
259258
/// // oops, this review has a lot of spelling mistakes, let's delete it.
260-
/// book_reviews.remove("The Adventures of Sherlock Holmes");
259+
/// book_reviews.remove(&("The Adventures of Sherlock Holmes"));
261260
///
262261
/// // look up the values associated with some keys.
263262
/// let to_find = ["Pride and Prejudice", "Alice's Adventure in Wonderland"];
264-
/// for book in &to_find {
263+
/// for book in to_find.iter() {
265264
/// match book_reviews.get(book) {
266-
/// Some(review) => println!("{}: {}", book, review),
267-
/// None => println!("{} is unreviewed.", book)
265+
/// Some(review) => println!("{}: {}", *book, *review),
266+
/// None => println!("{} is unreviewed.", *book)
268267
/// }
269268
/// }
270269
///
271270
/// // iterate over everything.
272-
/// for (book, review) in &book_reviews {
273-
/// println!("{}: \"{}\"", book, review);
271+
/// for (book, review) in book_reviews.iter() {
272+
/// println!("{}: \"{}\"", *book, *review);
274273
/// }
275274
/// ```
276275
///
@@ -301,7 +300,7 @@ fn test_resize_policy() {
301300
/// vikings.insert(Viking::new("Harald", "Iceland"), 12);
302301
///
303302
/// // Use derived implementation to print the status of the vikings.
304-
/// for (viking, health) in &vikings {
303+
/// for (viking, health) in vikings.iter() {
305304
/// println!("{:?} has {} hp", viking, health);
306305
/// }
307306
/// ```

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ 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 ().
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:
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:
4038
///
4139
/// ```text
4240
/// k1 == k2 -> hash(k1) == hash(k2)
@@ -66,17 +64,17 @@ use super::state::HashState;
6664
/// books.insert("The Great Gatsby");
6765
///
6866
/// // Check for a specific one.
69-
/// if !books.contains("The Winds of Winter") {
67+
/// if !books.contains(&("The Winds of Winter")) {
7068
/// println!("We have {} books, but The Winds of Winter ain't one.",
7169
/// books.len());
7270
/// }
7371
///
7472
/// // Remove a book.
75-
/// books.remove("The Odyssey");
73+
/// books.remove(&"The Odyssey");
7674
///
7775
/// // Iterate over everything.
78-
/// for book in &books {
79-
/// println!("{}", book);
76+
/// for book in books.iter() {
77+
/// println!("{}", *book);
8078
/// }
8179
/// ```
8280
///
@@ -100,7 +98,7 @@ use super::state::HashState;
10098
/// vikings.insert(Viking { name: "Harald", power: 8 });
10199
///
102100
/// // Use derived implementation to print the vikings.
103-
/// for x in &vikings {
101+
/// for x in vikings.iter() {
104102
/// println!("{:?}", x);
105103
/// }
106104
/// ```

0 commit comments

Comments
 (0)