Skip to content

Commit 196e2b1

Browse files
committed
---
yaml --- r: 233956 b: refs/heads/beta c: 405c616 h: refs/heads/master v: v3
1 parent 912ce4e commit 196e2b1

Some content is hidden

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

84 files changed

+877
-1010
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 2727a8e1c06f27169be6a414623880f118551dbd
26+
refs/heads/beta: 405c616eaf4e58a8bed67924c364c8e9c83b2581
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/doc/trpl/rust-inside-other-languages.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -217,17 +217,6 @@ And finally, we can try running it:
217217

218218
```bash
219219
$ ruby embed.rb
220-
Thread finished with count=5000000
221-
Thread finished with count=5000000
222-
Thread finished with count=5000000
223-
Thread finished with count=5000000
224-
Thread finished with count=5000000
225-
Thread finished with count=5000000
226-
Thread finished with count=5000000
227-
Thread finished with count=5000000
228-
Thread finished with count=5000000
229-
Thread finished with count=5000000
230-
done!
231220
done!
232221
$
233222
```

branches/beta/src/doc/trpl/structs.md

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

3-
`struct`s are a way of creating more complex data types. For example, if we were
3+
Structs are a way of creating more complex data types. For example, if we were
44
doing calculations involving coordinates in 2D space, we would need both an `x`
55
and a `y` value:
66

@@ -9,7 +9,7 @@ let origin_x = 0;
99
let origin_y = 0;
1010
```
1111

12-
A `struct` lets us combine these two into a single, unified datatype:
12+
A struct lets us combine these two into a single, unified datatype:
1313

1414
```rust
1515
struct Point {
@@ -28,14 +28,14 @@ There’s a lot going on here, so let’s break it down. We declare a `struct` w
2828
the `struct` keyword, and then with a name. By convention, `struct`s begin with
2929
a capital letter and are camel cased: `PointInSpace`, not `Point_In_Space`.
3030

31-
We can create an instance of our `struct` via `let`, as usual, but we use a `key:
31+
We can create an instance of our struct via `let`, as usual, but we use a `key:
3232
value` style syntax to set each field. The order doesn’t need to be the same as
3333
in the original declaration.
3434

3535
Finally, because fields have names, we can access the field through dot
3636
notation: `origin.x`.
3737

38-
The values in `struct`s are immutable by default, like other bindings in Rust.
38+
The values in structs are immutable by default, like other bindings in Rust.
3939
Use `mut` to make them mutable:
4040

4141
```rust
@@ -91,7 +91,7 @@ fn main() {
9191
# Update syntax
9292

9393
A `struct` can include `..` to indicate that you want to use a copy of some
94-
other `struct` for some of the values. For example:
94+
other struct for some of the values. For example:
9595

9696
```rust
9797
struct Point3d {
@@ -121,7 +121,7 @@ let point = Point3d { z: 1, x: 2, .. origin };
121121
# Tuple structs
122122

123123
Rust has another data type that’s like a hybrid between a [tuple][tuple] and a
124-
`struct`, called a ‘tuple struct’. Tuple structs have a name, but
124+
struct, called a ‘tuple struct’. Tuple structs have a name, but
125125
their fields don’t:
126126

127127
```rust
@@ -140,7 +140,7 @@ let black = Color(0, 0, 0);
140140
let origin = Point(0, 0, 0);
141141
```
142142

143-
It is almost always better to use a `struct` than a tuple struct. We would write
143+
It is almost always better to use a struct than a tuple struct. We would write
144144
`Color` and `Point` like this instead:
145145

146146
```rust
@@ -158,7 +158,7 @@ struct Point {
158158
```
159159

160160
Now, we have actual names, rather than positions. Good names are important,
161-
and with a `struct`, we have actual names.
161+
and with a struct, we have actual names.
162162

163163
There _is_ one case when a tuple struct is very useful, though, and that’s a
164164
tuple struct with only one element. We call this the ‘newtype’ pattern, because
@@ -180,13 +180,13 @@ destructuring `let`, just as with regular tuples. In this case, the
180180

181181
# Unit-like structs
182182

183-
You can define a `struct` with no members at all:
183+
You can define a struct with no members at all:
184184

185185
```rust
186186
struct Electron;
187187
```
188188

189-
Such a `struct` is called ‘unit-like’ because it resembles the empty
189+
Such a struct is called ‘unit-like’ because it resembles the empty
190190
tuple, `()`, sometimes called ‘unit’. Like a tuple struct, it defines a
191191
new type.
192192

@@ -195,6 +195,6 @@ marker type), but in combination with other features, it can become
195195
useful. For instance, a library may ask you to create a structure that
196196
implements a certain [trait][trait] to handle events. If you don’t have
197197
any data you need to store in the structure, you can just create a
198-
unit-like `struct`.
198+
unit-like struct.
199199

200200
[trait]: traits.html

branches/beta/src/doc/trpl/traits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ fn normal<T: ConvertTo<i64>>(x: &T) -> i64 {
390390

391391
// can be called with T == i64
392392
fn inverse<T>() -> T
393-
// this is using ConvertTo as if it were "ConvertTo<i64>"
393+
// this is using ConvertTo as if it were "ConvertFrom<i32>"
394394
where i32: ConvertTo<T> {
395395
42.convert()
396396
}

branches/beta/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_BINARY,
17-
LIT_BINARY_RAW, QUESTION, IDENT, LIFETIME, WHITESPACE, DOC_COMMENT,
16+
LIT_INTEGER, LIT_FLOAT, LIT_STR, LIT_STR_RAW, LIT_BYTE_STR,
17+
LIT_BYTE_STR_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_BINARY : 'b' LIT_STR ;
152-
LIT_BINARY_RAW : 'b' LIT_STR_RAW ;
151+
LIT_BYTE_STR : 'b' LIT_STR ;
152+
LIT_BYTE_STR_RAW : 'b' LIT_STR_RAW ;
153153

154154
/* this is a bit messy */
155155

branches/beta/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_BINARY; }
203+
<bytestr>\x22 { BEGIN(suffix); return LIT_BYTE_STR; }
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_BINARY_RAW; }
213+
<rawbytestr_nohash>\x22 { BEGIN(suffix); return LIT_BYTE_STR_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_BINARY_RAW;
231+
return LIT_BYTE_STR_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_BINARY_RAW;
240+
return LIT_BYTE_STR_RAW;
241241
}
242242
yymore();
243243
}

branches/beta/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_BINARY
56-
%token LIT_BINARY_RAW
55+
%token LIT_BYTE_STR
56+
%token LIT_BYTE_STR_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_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")); }
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")); }
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_BINARY { $$ = mk_atom(yytext); }
1819-
| LIT_BINARY_RAW { $$ = mk_atom(yytext); }
1818+
| LIT_BYTE_STR { $$ = mk_atom(yytext); }
1819+
| LIT_BYTE_STR_RAW { $$ = mk_atom(yytext); }
18201820
| IDENT { $$ = mk_atom(yytext); }
18211821
| UNDERSCORE { $$ = mk_atom(yytext); }
18221822
| LIFETIME { $$ = mk_atom(yytext); }

branches/beta/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_BINARY,
42-
LIT_BINARY_RAW,
41+
LIT_BYTE_STR,
42+
LIT_BYTE_STR_RAW,
4343
IDENT,
4444
UNDERSCORE,
4545
LIFETIME,

branches/beta/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_BINARY" => token::Literal(token::Binary(Name(0)), None),
111-
"LIT_BINARY_RAW" => token::Literal(token::BinaryRaw(Name(0), 0), None),
110+
"LIT_BYTE_STR" => token::Literal(token::ByteStr(Name(0)), None),
111+
"LIT_BYTE_STR_RAW" => token::Literal(token::ByteStrRaw(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/binary literal, strip out the leading/trailing
141-
/// hashes and surrounding quotes/raw/binary prefix.
140+
/// Assuming a string/byte string literal, strip out the leading/trailing
141+
/// hashes and surrounding quotes/raw/byte 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::Binary(..), n) => token::Literal(token::Binary(nm), n),
209-
token::Literal(token::BinaryRaw(..), n) => token::Literal(token::BinaryRaw(fix(content),
208+
token::Literal(token::ByteStr(..), n) => token::Literal(token::ByteStr(nm), n),
209+
token::Literal(token::ByteStrRaw(..), n) => token::Literal(token::ByteStrRaw(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::Binary(..), _),
344-
token::Literal(token::BinaryRaw(..), _),
343+
token::Literal(token::ByteStr(..), _),
344+
token::Literal(token::ByteStrRaw(..), _),
345345
token::Ident(..),
346346
token::Lifetime(..),
347347
token::Interpolated(..),

branches/beta/src/libcollections/btree/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ impl<K, V> Drop for Node<K, V> {
296296
self.destroy();
297297
}
298298

299-
self.keys = unsafe { Unique::new(ptr::null_mut()) };
299+
self.keys = unsafe { Unique::new(0 as *mut K) };
300300
}
301301
}
302302

branches/beta/src/libcollections/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ impl<T> ops::Deref for Vec<T> {
11351135
fn deref(&self) -> &[T] {
11361136
unsafe {
11371137
let p = self.buf.ptr();
1138-
assume(!p.is_null());
1138+
assume(p != 0 as *mut T);
11391139
slice::from_raw_parts(p, self.len)
11401140
}
11411141
}

branches/beta/src/libcore/cell.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl<T:Copy> Cell<T> {
231231
/// ```
232232
#[inline]
233233
#[unstable(feature = "as_unsafe_cell", issue = "27708")]
234-
pub unsafe fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
234+
pub unsafe fn as_unsafe_cell<'a>(&'a self) -> &'a UnsafeCell<T> {
235235
&self.value
236236
}
237237
}
@@ -387,7 +387,7 @@ impl<T: ?Sized> RefCell<T> {
387387
/// ```
388388
#[stable(feature = "rust1", since = "1.0.0")]
389389
#[inline]
390-
pub fn borrow(&self) -> Ref<T> {
390+
pub fn borrow<'a>(&'a self) -> Ref<'a, T> {
391391
match BorrowRef::new(&self.borrow) {
392392
Some(b) => Ref {
393393
_value: unsafe { &*self.value.get() },
@@ -433,7 +433,7 @@ impl<T: ?Sized> RefCell<T> {
433433
/// ```
434434
#[stable(feature = "rust1", since = "1.0.0")]
435435
#[inline]
436-
pub fn borrow_mut(&self) -> RefMut<T> {
436+
pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> {
437437
match BorrowRefMut::new(&self.borrow) {
438438
Some(b) => RefMut {
439439
_value: unsafe { &mut *self.value.get() },
@@ -450,7 +450,7 @@ impl<T: ?Sized> RefCell<T> {
450450
/// This function is `unsafe` because `UnsafeCell`'s field is public.
451451
#[inline]
452452
#[unstable(feature = "as_unsafe_cell", issue = "27708")]
453-
pub unsafe fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
453+
pub unsafe fn as_unsafe_cell<'a>(&'a self) -> &'a UnsafeCell<T> {
454454
&self.value
455455
}
456456
}
@@ -541,7 +541,7 @@ impl<'b, T: ?Sized> Deref for Ref<'b, T> {
541541
type Target = T;
542542

543543
#[inline]
544-
fn deref(&self) -> &T {
544+
fn deref<'a>(&'a self) -> &'a T {
545545
self._value
546546
}
547547
}
@@ -750,15 +750,15 @@ impl<'b, T: ?Sized> Deref for RefMut<'b, T> {
750750
type Target = T;
751751

752752
#[inline]
753-
fn deref(&self) -> &T {
753+
fn deref<'a>(&'a self) -> &'a T {
754754
self._value
755755
}
756756
}
757757

758758
#[stable(feature = "rust1", since = "1.0.0")]
759759
impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> {
760760
#[inline]
761-
fn deref_mut(&mut self) -> &mut T {
761+
fn deref_mut<'a>(&'a mut self) -> &'a mut T {
762762
self._value
763763
}
764764
}

0 commit comments

Comments
 (0)