Skip to content

Commit 7dac91b

Browse files
committed
---
yaml --- r: 216591 b: refs/heads/stable c: 464069a h: refs/heads/master i: 216589: 6fc2a00 216587: dea1480 216583: 80ec3a5 216575: 0d20320 v: v3
1 parent b67fef3 commit 7dac91b

Some content is hidden

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

47 files changed

+240
-412
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ refs/heads/tmp: 378a370ff2057afeb1eae86eb6e78c476866a4a6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: a5286998df566e736b32f6795bfc3803bdaf453d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 4fb22164a25a90543474d33fd51159e80806c9c5
32+
refs/heads/stable: 464069a4bfff2e94cb91c6cc5f0da40bba086bc4
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375

branches/stable/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/stable/src/libcollections/str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ impl str {
713713
/// is skipped if empty.
714714
///
715715
/// This method can be used for string data that is _terminated_,
716-
/// rather than _seperated_ by a pattern.
716+
/// rather than _separated_ by a pattern.
717717
///
718718
/// # Iterator behavior
719719
///
@@ -760,7 +760,7 @@ impl str {
760760
/// skipped if empty.
761761
///
762762
/// This method can be used for string data that is _terminated_,
763-
/// rather than _seperated_ by a pattern.
763+
/// rather than _separated_ by a pattern.
764764
///
765765
/// # Iterator behavior
766766
///

branches/stable/src/libcollections/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ impl FromUtf8Error {
757757
#[stable(feature = "rust1", since = "1.0.0")]
758758
pub fn into_bytes(self) -> Vec<u8> { self.bytes }
759759

760-
/// Accesss the underlying UTF8-error that was the cause of this error.
760+
/// Access the underlying UTF8-error that was the cause of this error.
761761
#[stable(feature = "rust1", since = "1.0.0")]
762762
pub fn utf8_error(&self) -> Utf8Error { self.error }
763763
}

branches/stable/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/stable/src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ use slice;
161161
// `Iterator` is an enumeration with one type parameter and two variants,
162162
// which basically means it must be `Option`.
163163

164-
/// The `Option` type. See [the module level documentation](index.html) for more.
164+
/// The `Option` type. See [the module level documentation](../index.html) for more.
165165
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
166166
#[stable(feature = "rust1", since = "1.0.0")]
167167
pub enum Option<T> {

branches/stable/src/libcore/str/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ macro_rules! derive_pattern_clone {
421421
/// wrapping an private internal one that makes use of the `Pattern` API.
422422
///
423423
/// For all patterns `P: Pattern<'a>` the following items will be
424-
/// generated (generics ommitted):
424+
/// generated (generics omitted):
425425
///
426426
/// struct $forward_iterator($internal_iterator);
427427
/// struct $reverse_iterator($internal_iterator);

branches/stable/src/librustc/middle/infer/higher_ranked/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ impl<'a,'tcx> InferCtxtExt for InferCtxt<'a,'tcx> {
461461

462462
/// Constructs and returns a substitution that, for a given type
463463
/// scheme parameterized by `generics`, will replace every generic
464-
/// parmeter in the type with a skolemized type/region (which one can
464+
/// parameter in the type with a skolemized type/region (which one can
465465
/// think of as a "fresh constant", except at the type/region level of
466466
/// reasoning).
467467
///

branches/stable/src/librustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1908,7 +1908,7 @@ pub enum Predicate<'tcx> {
19081908
}
19091909

19101910
impl<'tcx> Predicate<'tcx> {
1911-
/// Performs a substituion suitable for going from a
1911+
/// Performs a substitution suitable for going from a
19121912
/// poly-trait-ref to supertraits that must hold if that
19131913
/// poly-trait-ref holds. This is slightly different from a normal
19141914
/// substitution in terms of what happens with bound regions. See

branches/stable/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/stable/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
/// ```

0 commit comments

Comments
 (0)