Skip to content

Commit 450badb

Browse files
committed
---
yaml --- r: 234336 b: refs/heads/tmp c: 3427760 h: refs/heads/master v: v3
1 parent 7a49a3c commit 450badb

Some content is hidden

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

55 files changed

+1344
-269
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: d2e13e822a73e0ea46ae9e21afdd3155fc997f6d
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: 791e7bcb418381480bf10cb87ef5da769be7143f
28+
refs/heads/tmp: 34277600ac88e516f3f47299cd8dc546a400f9ae
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: ab792abf1fcc28afbd315426213f6428da25c085
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/src/doc/grammar.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ type_path_tail : '<' type_expr [ ',' type_expr ] + '>'
281281
## Macros
282282

283283
```antlr
284-
expr_macro_rules : "macro_rules" '!' ident '(' macro_rule * ')' ';'
284+
expr_macro_rules : "macro_rules" '!' ident '(' macro_rule * ')' ';'
285285
| "macro_rules" '!' ident '{' macro_rule * '}' ;
286286
macro_rule : '(' matcher * ')' "=>" '(' transcriber * ')' ';' ;
287287
matcher : '(' matcher * ')' | '[' matcher * ']'
@@ -306,7 +306,7 @@ transcriber : '(' transcriber * ')' | '[' transcriber * ']'
306306

307307
```antlr
308308
item : vis ? mod_item | fn_item | type_item | struct_item | enum_item
309-
| const_item | static_item | trait_item | impl_item | extern_block_item ;
309+
| const_item | static_item | trait_item | impl_item | extern_block ;
310310
```
311311

312312
### Type Parameters
@@ -636,31 +636,31 @@ lambda_expr : '|' ident_list '|' expr ;
636636
### While loops
637637

638638
```antlr
639-
while_expr : [ lifetime ':' ] ? "while" no_struct_literal_expr '{' block '}' ;
639+
while_expr : [ lifetime ':' ] "while" no_struct_literal_expr '{' block '}' ;
640640
```
641641

642642
### Infinite loops
643643

644644
```antlr
645-
loop_expr : [ lifetime ':' ] ? "loop" '{' block '}';
645+
loop_expr : [ lifetime ':' ] "loop" '{' block '}';
646646
```
647647

648648
### Break expressions
649649

650650
```antlr
651-
break_expr : "break" [ lifetime ] ?;
651+
break_expr : "break" [ lifetime ];
652652
```
653653

654654
### Continue expressions
655655

656656
```antlr
657-
continue_expr : "continue" [ lifetime ] ?;
657+
continue_expr : "continue" [ lifetime ];
658658
```
659659

660660
### For expressions
661661

662662
```antlr
663-
for_expr : [ lifetime ':' ] ? "for" pat "in" no_struct_literal_expr '{' block '}' ;
663+
for_expr : [ lifetime ':' ] "for" pat "in" no_struct_literal_expr '{' block '}' ;
664664
```
665665

666666
### If expressions
@@ -688,12 +688,13 @@ match_pat : pat [ '|' pat ] * [ "if" expr ] ? ;
688688
```antlr
689689
if_let_expr : "if" "let" pat '=' expr '{' block '}'
690690
else_tail ? ;
691+
else_tail : "else" [ if_expr | if_let_expr | '{' block '}' ] ;
691692
```
692693

693694
### While let loops
694695

695696
```antlr
696-
while_let_expr : [ lifetime ':' ] ? "while" "let" pat '=' expr '{' block '}' ;
697+
while_let_expr : "while" "let" pat '=' expr '{' block '}' ;
697698
```
698699

699700
### Return expressions
@@ -753,6 +754,8 @@ return_expr : "return" expr ? ;
753754
```antlr
754755
closure_type := [ 'unsafe' ] [ '<' lifetime-list '>' ] '|' arg-list '|'
755756
[ ':' bound-list ] [ '->' type ]
757+
procedure_type := 'proc' [ '<' lifetime-list '>' ] '(' arg-list ')'
758+
[ ':' bound-list ] [ '->' type ]
756759
lifetime-list := lifetime | lifetime ',' lifetime-list
757760
arg-list := ident ':' type | ident ':' type ',' arg-list
758761
bound-list := bound | bound '+' bound-list

branches/tmp/src/doc/reference.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3200,6 +3200,16 @@ let z = match x { &0 => "zero", _ => "some" };
32003200
assert_eq!(y, z);
32013201
```
32023202

3203+
A pattern that's just an identifier, like `Nil` in the previous example, could
3204+
either refer to an enum variant that's in scope, or bind a new variable. The
3205+
compiler resolves this ambiguity by forbidding variable bindings that occur in
3206+
`match` patterns from shadowing names of variants that are in scope. For
3207+
example, wherever `List` is in scope, a `match` pattern would not be able to
3208+
bind `Nil` as a new name. The compiler interprets a variable pattern `x` as a
3209+
binding _only_ if there is no variant named `x` in scope. A convention you can
3210+
use to avoid conflicts is simply to name variants with upper-case letters, and
3211+
local variables with lower-case letters.
3212+
32033213
Multiple match patterns may be joined with the `|` operator. A range of values
32043214
may be specified with `...`. For example:
32053215

branches/tmp/src/doc/trpl/choosing-your-guarantees.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% Choosing your Guarantees
22

3-
One important feature of Rust is that it lets us control the costs and guarantees
3+
One important feature of Rust as language is that it lets us control the costs and guarantees
44
of a program.
55

66
There are various &ldquo;wrapper type&rdquo; abstractions in the Rust standard library which embody
@@ -18,9 +18,9 @@ Before proceeding, it is highly recommended that one reads about [ownership][own
1818

1919
## `Box<T>`
2020

21-
[`Box<T>`][box] is an &ldquo;owned&rdquo; pointer, or a &ldquo;box&rdquo;. While it can hand
22-
out references to the contained data, it is the only owner of the data. In particular, consider
23-
the following:
21+
[`Box<T>`][box] is pointer which is &ldquo;owned&rdquo;, or a &ldquo;box&rdquo;. While it can hand
22+
out references to the contained data, it is the only owner of the data. In particular, when
23+
something like the following occurs:
2424

2525
```rust
2626
let x = Box::new(1);
@@ -40,7 +40,7 @@ allowed to share references to this by the regular borrowing rules, checked at c
4040

4141
[box]: ../std/boxed/struct.Box.html
4242

43-
## `&T` and `&mut T`
43+
## `&T` and `&mut T`
4444

4545
These are immutable and mutable references respectively. They follow the &ldquo;read-write lock&rdquo;
4646
pattern, such that one may either have only one mutable reference to some data, or any number of
@@ -243,7 +243,7 @@ Many of the types above cannot be used in a threadsafe manner. Particularly, `Rc
243243
`RefCell<T>`, which both use non-atomic reference counts (_atomic_ reference counts are those which
244244
can be incremented from multiple threads without causing a data race), cannot be used this way. This
245245
makes them cheaper to use, but we need thread safe versions of these too. They exist, in the form of
246-
`Arc<T>` and `Mutex<T>`/`RwLock<T>`
246+
`Arc<T>` and `Mutex<T>`/`RWLock<T>`
247247

248248
Note that the non-threadsafe types _cannot_ be sent between threads, and this is checked at compile
249249
time.

branches/tmp/src/doc/trpl/deref-coercions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ Vectors can `Deref` to a slice.
8989

9090
## Deref and method calls
9191

92-
`Deref` will also kick in when calling a method. Consider the following
93-
example.
92+
`Deref` will also kick in when calling a method. In other words, these are
93+
the same two things in Rust:
9494

9595
```rust
9696
struct Foo;
@@ -99,13 +99,13 @@ impl Foo {
9999
fn foo(&self) { println!("Foo"); }
100100
}
101101

102-
let f = &&Foo;
102+
let f = Foo;
103103

104104
f.foo();
105105
```
106106

107-
Even though `f` is a `&&Foo` and `foo` takes `&self`, this works. That’s
108-
because these things are the same:
107+
Even though `f` isn’t a reference, and `foo` takes `&self`, this works.
108+
That’s because these things are the same:
109109

110110
```rust,ignore
111111
f.foo();

branches/tmp/src/doc/trpl/the-stack-and-the-heap.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ local variables and some other information. This is called a ‘stack frame’,
3838
for the purpose of this tutorial, we’re going to ignore the extra information
3939
and just consider the local variables we’re allocating. So in this case, when
4040
`main()` is run, we’ll allocate a single 32-bit integer for our stack frame.
41-
This is automatically handled for you, as you can see; we didn’t have to write
41+
This is automatically handled for you, as you can see, we didn’t have to write
4242
any special Rust code or anything.
4343

4444
When the function is over, its stack frame gets deallocated. This happens
@@ -51,7 +51,7 @@ we’ll throw them all away at the same time as well, we can get rid of it very
5151
fast too.
5252

5353
The downside is that we can’t keep values around if we need them for longer
54-
than a single function. We also haven’t talked about what the word, ‘stack’,
54+
than a single function. We also haven’t talked about what that name, ‘stack’
5555
means. To do that, we need a slightly more complicated example:
5656

5757
```rust

branches/tmp/src/grammar/RustLexer.g4

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ tokens {
1313
BINOPEQ, AT, DOT, DOTDOT, DOTDOTDOT, COMMA, SEMI, COLON,
1414
MOD_SEP, RARROW, FAT_ARROW, LPAREN, RPAREN, LBRACKET, RBRACKET,
1515
LBRACE, RBRACE, POUND, DOLLAR, UNDERSCORE, LIT_CHAR, LIT_BYTE,
16-
LIT_INTEGER, LIT_FLOAT, LIT_STR, LIT_STR_RAW, LIT_BYTE_STR,
17-
LIT_BYTE_STR_RAW, QUESTION, IDENT, LIFETIME, WHITESPACE, DOC_COMMENT,
16+
LIT_INTEGER, LIT_FLOAT, LIT_STR, LIT_STR_RAW, LIT_BINARY,
17+
LIT_BINARY_RAW, QUESTION, IDENT, LIFETIME, WHITESPACE, DOC_COMMENT,
1818
COMMENT, SHEBANG, UTF8_BOM
1919
}
2020

@@ -148,8 +148,8 @@ LIT_STR
148148
: '"' ('\\\n' | '\\\r\n' | '\\' CHAR_ESCAPE | .)*? '"' SUFFIX?
149149
;
150150

151-
LIT_BYTE_STR : 'b' LIT_STR ;
152-
LIT_BYTE_STR_RAW : 'b' LIT_STR_RAW ;
151+
LIT_BINARY : 'b' LIT_STR ;
152+
LIT_BINARY_RAW : 'b' LIT_STR_RAW ;
153153

154154
/* this is a bit messy */
155155

branches/tmp/src/grammar/lexer.l

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ while { return WHILE; }
200200
<ltorchar><<EOF>> { BEGIN(INITIAL); return -1; }
201201

202202
b\x22 { BEGIN(bytestr); yymore(); }
203-
<bytestr>\x22 { BEGIN(suffix); return LIT_BYTE_STR; }
203+
<bytestr>\x22 { BEGIN(suffix); return LIT_BINARY; }
204204

205205
<bytestr><<EOF>> { return -1; }
206206
<bytestr>\\[n\nrt\\\x27\x220] { yymore(); }
@@ -210,7 +210,7 @@ b\x22 { BEGIN(bytestr); yymore(); }
210210
<bytestr>(.|\n) { yymore(); }
211211

212212
br\x22 { BEGIN(rawbytestr_nohash); yymore(); }
213-
<rawbytestr_nohash>\x22 { BEGIN(suffix); return LIT_BYTE_STR_RAW; }
213+
<rawbytestr_nohash>\x22 { BEGIN(suffix); return LIT_BINARY_RAW; }
214214
<rawbytestr_nohash>(.|\n) { yymore(); }
215215
<rawbytestr_nohash><<EOF>> { return -1; }
216216

@@ -228,7 +228,7 @@ br/# {
228228
end_hashes++;
229229
if (end_hashes == num_hashes) {
230230
BEGIN(INITIAL);
231-
return LIT_BYTE_STR_RAW;
231+
return LIT_BINARY_RAW;
232232
}
233233
}
234234
yymore();
@@ -237,7 +237,7 @@ br/# {
237237
end_hashes = 1;
238238
if (end_hashes == num_hashes) {
239239
BEGIN(INITIAL);
240-
return LIT_BYTE_STR_RAW;
240+
return LIT_BINARY_RAW;
241241
}
242242
yymore();
243243
}

branches/tmp/src/grammar/parser-lalr.y

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ extern char *yytext;
5252
%token LIT_FLOAT
5353
%token LIT_STR
5454
%token LIT_STR_RAW
55-
%token LIT_BYTE_STR
56-
%token LIT_BYTE_STR_RAW
55+
%token LIT_BINARY
56+
%token LIT_BINARY_RAW
5757
%token IDENT
5858
%token UNDERSCORE
5959
%token LIFETIME
@@ -1772,8 +1772,8 @@ lit
17721772
str
17731773
: LIT_STR { $$ = mk_node("LitStr", 1, mk_atom(yytext), mk_atom("CookedStr")); }
17741774
| LIT_STR_RAW { $$ = mk_node("LitStr", 1, mk_atom(yytext), mk_atom("RawStr")); }
1775-
| LIT_BYTE_STR { $$ = mk_node("LitByteStr", 1, mk_atom(yytext), mk_atom("ByteStr")); }
1776-
| LIT_BYTE_STR_RAW { $$ = mk_node("LitByteStr", 1, mk_atom(yytext), mk_atom("RawByteStr")); }
1775+
| LIT_BINARY { $$ = mk_node("LitBinary", 1, mk_atom(yytext), mk_atom("BinaryStr")); }
1776+
| LIT_BINARY_RAW { $$ = mk_node("LitBinary", 1, mk_atom(yytext), mk_atom("RawBinaryStr")); }
17771777
;
17781778

17791779
maybe_ident
@@ -1815,8 +1815,8 @@ unpaired_token
18151815
| LIT_FLOAT { $$ = mk_atom(yytext); }
18161816
| LIT_STR { $$ = mk_atom(yytext); }
18171817
| LIT_STR_RAW { $$ = mk_atom(yytext); }
1818-
| LIT_BYTE_STR { $$ = mk_atom(yytext); }
1819-
| LIT_BYTE_STR_RAW { $$ = mk_atom(yytext); }
1818+
| LIT_BINARY { $$ = mk_atom(yytext); }
1819+
| LIT_BINARY_RAW { $$ = mk_atom(yytext); }
18201820
| IDENT { $$ = mk_atom(yytext); }
18211821
| UNDERSCORE { $$ = mk_atom(yytext); }
18221822
| LIFETIME { $$ = mk_atom(yytext); }

branches/tmp/src/grammar/tokens.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ enum Token {
3838
LIT_FLOAT,
3939
LIT_STR,
4040
LIT_STR_RAW,
41-
LIT_BYTE_STR,
42-
LIT_BYTE_STR_RAW,
41+
LIT_BINARY,
42+
LIT_BINARY_RAW,
4343
IDENT,
4444
UNDERSCORE,
4545
LIFETIME,

branches/tmp/src/grammar/verify.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ fn parse_token_list(file: &str) -> HashMap<String, token::Token> {
107107
"OR" => token::BinOp(token::Or),
108108
"GT" => token::Gt,
109109
"LE" => token::Le,
110-
"LIT_BYTE_STR" => token::Literal(token::ByteStr(Name(0)), None),
111-
"LIT_BYTE_STR_RAW" => token::Literal(token::ByteStrRaw(Name(0), 0), None),
110+
"LIT_BINARY" => token::Literal(token::Binary(Name(0)), None),
111+
"LIT_BINARY_RAW" => token::Literal(token::BinaryRaw(Name(0), 0), None),
112112
"QUESTION" => token::Question,
113113
"SHEBANG" => token::Shebang(Name(0)),
114114
_ => continue,
@@ -137,8 +137,8 @@ fn str_to_binop(s: &str) -> token::BinOpToken {
137137
}
138138
}
139139

140-
/// Assuming a string/byte string literal, strip out the leading/trailing
141-
/// hashes and surrounding quotes/raw/byte prefix.
140+
/// Assuming a string/binary literal, strip out the leading/trailing
141+
/// hashes and surrounding quotes/raw/binary prefix.
142142
fn fix(mut lit: &str) -> ast::Name {
143143
if lit.char_at(0) == 'r' {
144144
if lit.char_at(1) == 'b' {
@@ -205,8 +205,8 @@ fn parse_antlr_token(s: &str, tokens: &HashMap<String, token::Token>, surrogate_
205205
token::DocComment(..) => token::DocComment(nm),
206206
token::Literal(token::Integer(..), n) => token::Literal(token::Integer(nm), n),
207207
token::Literal(token::Float(..), n) => token::Literal(token::Float(nm), n),
208-
token::Literal(token::ByteStr(..), n) => token::Literal(token::ByteStr(nm), n),
209-
token::Literal(token::ByteStrRaw(..), n) => token::Literal(token::ByteStrRaw(fix(content),
208+
token::Literal(token::Binary(..), n) => token::Literal(token::Binary(nm), n),
209+
token::Literal(token::BinaryRaw(..), n) => token::Literal(token::BinaryRaw(fix(content),
210210
count(content)), n),
211211
token::Ident(..) => token::Ident(ast::Ident { name: nm, ctxt: 0 },
212212
token::ModName),
@@ -340,8 +340,8 @@ fn main() {
340340
token::Literal(token::Float(..), _),
341341
token::Literal(token::Str_(..), _),
342342
token::Literal(token::StrRaw(..), _),
343-
token::Literal(token::ByteStr(..), _),
344-
token::Literal(token::ByteStrRaw(..), _),
343+
token::Literal(token::Binary(..), _),
344+
token::Literal(token::BinaryRaw(..), _),
345345
token::Ident(..),
346346
token::Lifetime(..),
347347
token::Interpolated(..),

branches/tmp/src/liballoc/rc.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
//! fn main() {
5252
//! // Create a reference counted Owner.
5353
//! let gadget_owner : Rc<Owner> = Rc::new(
54-
//! Owner { name: String::from("Gadget Man") }
54+
//! Owner { name: String::from("Gadget Man") }
5555
//! );
5656
//!
5757
//! // Create Gadgets belonging to gadget_owner. To increment the reference
@@ -102,13 +102,13 @@
102102
//!
103103
//! struct Owner {
104104
//! name: String,
105-
//! gadgets: RefCell<Vec<Weak<Gadget>>>,
105+
//! gadgets: RefCell<Vec<Weak<Gadget>>>
106106
//! // ...other fields
107107
//! }
108108
//!
109109
//! struct Gadget {
110110
//! id: i32,
111-
//! owner: Rc<Owner>,
111+
//! owner: Rc<Owner>
112112
//! // ...other fields
113113
//! }
114114
//!
@@ -117,10 +117,10 @@
117117
//! // Owner's vector of Gadgets inside a RefCell so that we can mutate it
118118
//! // through a shared reference.
119119
//! let gadget_owner : Rc<Owner> = Rc::new(
120-
//! Owner {
121-
//! name: "Gadget Man".to_string(),
122-
//! gadgets: RefCell::new(Vec::new()),
123-
//! }
120+
//! Owner {
121+
//! name: "Gadget Man".to_string(),
122+
//! gadgets: RefCell::new(Vec::new())
123+
//! }
124124
//! );
125125
//!
126126
//! // Create Gadgets belonging to gadget_owner as before.

0 commit comments

Comments
 (0)