Skip to content

Commit 8e86aef

Browse files
committed
---
yaml --- r: 210294 b: refs/heads/try c: b630cd7 h: refs/heads/master v: v3
1 parent 7c220ff commit 8e86aef

File tree

23 files changed

+214
-109
lines changed

23 files changed

+214
-109
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: 60f01b49af090a5f3dbcbf2ef6fc6a000be31202
5+
refs/heads/try: b630cd74dc1ab65840397ba2a7d1c8009c1ef721
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/doc/complement-lang-faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ This does mean that indexed access to a Unicode codepoint inside a `str` value i
109109
* Most "character oriented" operations on text only work under very restricted language assumptions sets such as "ASCII-range codepoints only". Outside ASCII-range, you tend to have to use a complex (non-constant-time) algorithm for determining linguistic-unit (glyph, word, paragraph) boundaries anyways. We recommend using an "honest" linguistically-aware, Unicode-approved algorithm.
110110
* The `char` type is UCS4. If you honestly need to do a codepoint-at-a-time algorithm, it's trivial to write a `type wstr = [char]`, and unpack a `str` into it in a single pass, then work with the `wstr`. In other words: the fact that the language is not "decoding to UCS4 by default" shouldn't stop you from decoding (or re-encoding any other way) if you need to work with that encoding.
111111

112-
## Why are strings, vectors etc. built-in types rather than (say) special kinds of trait/impl?
112+
## Why are `str`s, slices, arrays etc. built-in types rather than (say) special kinds of trait/impl?
113113

114114
In each case there is one or more operator, literal constructor, overloaded use or integration with a built-in control structure that makes us think it would be awkward to phrase the type in terms of more-general type constructors. Same as, say, with numbers! But this is partly an aesthetic call, and we'd be willing to look at a worked-out proposal for eliminating or rephrasing these special cases.
115115

branches/try/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));

branches/try/src/doc/trpl/installing-rust.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ or a Mac, all you need to do is this (note that you don't need to type in the
66
`$`s, they just indicate the start of each command):
77

88
```bash
9-
$ curl -sf -L https://static.rust-lang.org/rustup.sh | sh
9+
$ curl -sf -L https://static.rust-lang.org/rustup.sh | sudo sh
1010
```
1111

1212
If you're concerned about the [potential insecurity][insecurity] of using `curl
13-
| sh`, please keep reading and see our disclaimer below. And feel free to
13+
| sudo sh`, please keep reading and see our disclaimer below. And feel free to
1414
use a two-step version of the installation and examine our installation script:
1515

1616
```bash
1717
$ curl -f -L https://static.rust-lang.org/rustup.sh -O
18-
$ sh rustup.sh
18+
$ sudo sh rustup.sh
1919
```
2020

2121
[insecurity]: http://curlpipesh.tumblr.com
@@ -40,11 +40,13 @@ If you used the Windows installer, just re-run the `.msi` and it will give you
4040
an uninstall option.
4141

4242
Some people, and somewhat rightfully so, get very upset when we tell you to
43-
`curl | sh`. Basically, when you do this, you are trusting that the good
43+
`curl | sudo sh`. Basically, when you do this, you are trusting that the good
4444
people who maintain Rust aren't going to hack your computer and do bad things.
4545
That's a good instinct! If you're one of those people, please check out the
4646
documentation on [building Rust from Source][from source], or [the official
47-
binary downloads][install page].
47+
binary downloads][install page]. And we promise that this method will not be
48+
the way to install Rust forever: it's just the easiest way to keep people
49+
updated while Rust is in its alpha state.
4850

4951
[from source]: https://github.com/rust-lang/rust#building-from-source
5052
[install page]: http://www.rust-lang.org/install.html

branches/try/src/doc/trpl/nightly-rust.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ process, see ‘[Stability as a deliverable][stability]’.
99
To install nightly Rust, you can use `rustup.sh`:
1010

1111
```bash
12-
$ curl -s https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly
12+
$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh -s -- --channel=nightly
1313
```
1414

1515
If you're concerned about the [potential insecurity][insecurity] of using `curl
16-
| sh`, please keep reading and see our disclaimer below. And feel free to
16+
| sudo sh`, please keep reading and see our disclaimer below. And feel free to
1717
use a two-step version of the installation and examine our installation script:
1818

1919
```bash
2020
$ curl -f -L https://static.rust-lang.org/rustup.sh -O
21-
$ sh rustup.sh --channel=nightly
21+
$ sudo sh rustup.sh --channel=nightly
2222
```
2323

2424
[insecurity]: http://curlpipesh.tumblr.com
@@ -43,11 +43,13 @@ If you used the Windows installer, just re-run the `.msi` and it will give you
4343
an uninstall option.
4444

4545
Some people, and somewhat rightfully so, get very upset when we tell you to
46-
`curl | sh`. Basically, when you do this, you are trusting that the good
46+
`curl | sudo sh`. Basically, when you do this, you are trusting that the good
4747
people who maintain Rust aren't going to hack your computer and do bad things.
4848
That's a good instinct! If you're one of those people, please check out the
4949
documentation on [building Rust from Source][from source], or [the official
50-
binary downloads][install page].
50+
binary downloads][install page]. And we promise that this method will not be
51+
the way to install Rust forever: it's just the easiest way to keep people
52+
updated while Rust is in its alpha state.
5153

5254
[from source]: https://github.com/rust-lang/rust#building-from-source
5355
[install page]: http://www.rust-lang.org/install.html
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/try/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 _separated_ by a pattern.
716+
/// rather than _seperated_ 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 _separated_ by a pattern.
763+
/// rather than _seperated_ by a pattern.
764764
///
765765
/// # Iterator behavior
766766
///

branches/try/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-
/// Access the underlying UTF8-error that was the cause of this error.
760+
/// Accesss 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/try/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/try/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/try/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 omitted):
424+
/// generated (generics ommitted):
425425
///
426426
/// struct $forward_iterator($internal_iterator);
427427
/// struct $reverse_iterator($internal_iterator);

branches/try/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-
/// parameter in the type with a skolemized type/region (which one can
464+
/// parmeter 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/try/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 substitution suitable for going from a
1911+
/// Performs a substituion 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/try/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
});

0 commit comments

Comments
 (0)