Skip to content

Commit 9e3d148

Browse files
committed
---
yaml --- r: 183549 b: refs/heads/beta c: 65eab6e h: refs/heads/master i: 183547: c2ad2d0 v: v3
1 parent 835a187 commit 9e3d148

Some content is hidden

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

91 files changed

+2870
-5264
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: 33371bfc41349c4e127e10b71ef2891513079b9c
34+
refs/heads/beta: 65eab6eb979ecaff246d618666151bf5317211fb
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: eb836bf767aa1d8d4cba488a9091cde3c0ab4b2f

branches/beta/configure

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,8 +1379,7 @@ do
13791379
done
13801380

13811381
# Munge any paths that appear in config.mk back to posix-y
1382-
cp config.tmp config.tmp.bak
1383-
sed -e 's@ \([a-zA-Z]\):[/\\]@ /\1/@g;' <config.tmp.bak >config.tmp
1382+
sed -i.bak -e 's@ \([a-zA-Z]\):[/\\]@ /\1/@g;' config.tmp
13841383
rm -f config.tmp.bak
13851384

13861385
msg

branches/beta/mk/main.mk

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,13 @@ SPACE :=
6161
SPACE +=
6262
ifneq ($(CFG_GIT),)
6363
ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
64-
CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --date=short --pretty=format:'%cd')
64+
CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --pretty=format:'%ci')
6565
CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)
6666
CFG_SHORT_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse --short=9 HEAD)
6767
CFG_VERSION += ($(CFG_SHORT_VER_HASH) $(CFG_VER_DATE))
6868
endif
6969
endif
7070

71-
CFG_BUILD_DATE = $(shell date +%F)
72-
CFG_VERSION += (built $(CFG_BUILD_DATE))
73-
7471
# Windows exe's need numeric versions - don't use anything but
7572
# numbers and dots here
7673
CFG_VERSION_WIN = $(CFG_RELEASE_NUM)
@@ -320,7 +317,6 @@ endif
320317
ifdef CFG_VER_HASH
321318
export CFG_VER_HASH
322319
endif
323-
export CFG_BUILD_DATE
324320
export CFG_VERSION
325321
export CFG_VERSION_WIN
326322
export CFG_RELEASE

branches/beta/src/doc/complement-bugreport.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ $ RUST_BACKTRACE=1 rustc ...
5656

5757
# I submitted a bug, but nobody has commented on it!
5858

59-
This is sad, but does happen sometimes, since we're short-staffed. If you submit a
60-
bug and you haven't received a comment on it within 3 business days, it's entirely
61-
reasonable to ask about the status of the bug in #rust on irc.mozilla.org.
59+
This is sad, but does happen sometimes, since we're short-staffed. If you
60+
submit a bug and you haven't received a comment on it within 3 business days,
61+
it's entirely reasonable to either ask on the #rust IRC channel,
62+
or post on the [rust-dev mailing list](https://mail.mozilla.org/listinfo/rust-dev)
63+
to ask what the status of the bug is.

branches/beta/src/doc/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ segfault when we allocate more memory?
224224

225225
The answer is that in the C++ version, `x` is a *reference* to the memory
226226
location where the first element of the array is stored. But in Ruby, `x` is a
227-
standalone value, not connected to the underlying array at all. Let's dig into
227+
standalone value, not connected to the underyling array at all. Let's dig into
228228
the details for a moment. Your program has access to memory, provided to it by
229229
the operating system. Each location in memory has an address. So when we make
230230
our vector, `v`, it's stored in a memory location somewhere:

branches/beta/src/doc/reference.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2591,8 +2591,9 @@ of any reference that points to it.
25912591

25922592
When a [local variable](#memory-slots) is used as an
25932593
[rvalue](#lvalues,-rvalues-and-temporaries) the variable will either be moved
2594-
or copied, depending on its type. All values whose type implements `Copy` are
2595-
copied, all others are moved.
2594+
or copied, depending on its type. For types that contain [owning
2595+
pointers](#pointer-types) or values that implement the special trait `Drop`,
2596+
the variable is moved. All other types are copied.
25962597

25972598
### Literal expressions
25982599

@@ -3004,7 +3005,7 @@ Some examples of call expressions:
30043005
# fn add(x: i32, y: i32) -> i32 { 0 }
30053006
30063007
let x: i32 = add(1i32, 2i32);
3007-
let pi: Result<f32, _> = "3.14".parse();
3008+
let pi: Option<f32> = "3.14".parse().ok();
30083009
```
30093010

30103011
### Lambda expressions
@@ -3147,7 +3148,7 @@ An example of a for loop over a series of integers:
31473148

31483149
```
31493150
# fn bar(b:usize) { }
3150-
for i in 0us..256 {
3151+
for i in range(0us, 256) {
31513152
bar(i);
31523153
}
31533154
```
@@ -3531,7 +3532,7 @@ An example of each kind:
35313532
```{rust}
35323533
let vec: Vec<i32> = vec![1, 2, 3];
35333534
let arr: [i32; 3] = [1, 2, 3];
3534-
let s: &[i32] = &vec[];
3535+
let s: &[i32] = &vec;
35353536
```
35363537

35373538
As you can see, the `vec!` macro allows you to create a `Vec<T>` easily. The

branches/beta/src/doc/trpl/compound-data-types.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,15 @@ let four_is_smaller = four <= ten;
263263
let four_equals_ten = four == ten;
264264
```
265265

266-
This may seem rather limiting, but it's a limitation which we can overcome.
267-
There are two ways: by implementing equality ourselves, or by using the
268-
[`match`][match] keyword. We don't know enough about Rust to implement equality
269-
yet, but we can use the `Ordering` enum from the standard library, which does:
266+
This may seem rather limiting, particularly equality being invalid; in
267+
many cases however, it's unnecessary. Rust provides the [`match`][match]
268+
keyword, which will be examined in more detail in the next section, which
269+
often allows better and easier branch control than a series of `if`/`else`
270+
statements would. However, for our [game][game] we need the comparisons
271+
to work so we will utilize the `Ordering` `enum` provided by the standard
272+
library which supports such comparisons. It has this form:
270273

271-
```
274+
```{rust}
272275
enum Ordering {
273276
Less,
274277
Equal,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ use std::sync::mpsc;
354354
fn main() {
355355
let (tx, rx) = mpsc::channel();
356356
357-
for _ in 0..10 {
357+
for _ in range(0, 10) {
358358
let tx = tx.clone();
359359
360360
Thread::spawn(move || {

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

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
% Documentation
1+
% Rust Documentation
22

33
`rustdoc` is the built-in tool for generating documentation. It integrates
44
with the compiler to provide accurate hyperlinking between usage of types and
@@ -294,26 +294,3 @@ Documentation` on the first line).
294294
Like with a Rust crate, the `--test` argument will run the code
295295
examples to check they compile, and obeys any `--test-args` flags. The
296296
tests are named after the last `#` heading.
297-
298-
# Re-exports
299-
300-
Rustdoc will show the documentation for a publc re-export in both places:
301-
302-
```{rust,ignore}
303-
extern crate foo;
304-
305-
pub use foo::bar;
306-
```
307-
308-
This will create documentation for `bar` both inside the documentation for
309-
the crate `foo`, as well as the documentation for your crate. It will use
310-
the same documentation in both places.
311-
312-
This behavior can be supressed with `no_inline`:
313-
314-
```{rust,ignore}
315-
extern crate foo;
316-
317-
#[doc(no_inline)]
318-
pub use foo::bar;
319-
```

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

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
You've already seen one function so far, the `main` function:
44

5-
```{rust}
5+
```rust
66
fn main() {
77
}
88
```
@@ -12,22 +12,22 @@ This is the simplest possible function declaration. As we mentioned before,
1212
this function takes no arguments, and then some curly braces to indicate the
1313
body. Here's a function named `foo`:
1414

15-
```{rust}
15+
```rust
1616
fn foo() {
1717
}
1818
```
1919

2020
So, what about taking arguments? Here's a function that prints a number:
2121

22-
```{rust}
22+
```rust
2323
fn print_number(x: i32) {
2424
println!("x is: {}", x);
2525
}
2626
```
2727

2828
Here's a complete program that uses `print_number`:
2929

30-
```{rust}
30+
```rust
3131
fn main() {
3232
print_number(5);
3333
}
@@ -42,7 +42,7 @@ you add a type to the argument name, after a colon.
4242

4343
Here's a complete program that adds two numbers together and prints them:
4444

45-
```{rust}
45+
```rust
4646
fn main() {
4747
print_sum(5, 6);
4848
}
@@ -58,7 +58,7 @@ as when you declare it.
5858
Unlike `let`, you _must_ declare the types of function arguments. This does
5959
not work:
6060

61-
```{ignore}
61+
```{rust,ignore}
6262
fn print_sum(x, y) {
6363
println!("x is: {}", x + y);
6464
}
@@ -79,7 +79,7 @@ sweet spot between full inference and no inference.
7979

8080
What about returning a value? Here's a function that adds one to an integer:
8181

82-
```{rust}
82+
```rust
8383
fn add_one(x: i32) -> i32 {
8484
x + 1
8585
}
@@ -90,7 +90,7 @@ Rust functions return exactly one value, and you declare the type after an
9090

9191
You'll note the lack of a semicolon here. If we added it in:
9292

93-
```{ignore}
93+
```{rust,ignore}
9494
fn add_one(x: i32) -> i32 {
9595
x + 1;
9696
}
@@ -123,7 +123,7 @@ semicolon in a return position would cause a bug.
123123

124124
But what about early returns? Rust does have a keyword for that, `return`:
125125

126-
```{rust}
126+
```rust
127127
fn foo(x: i32) -> i32 {
128128
if x < 5 { return x; }
129129

@@ -134,7 +134,7 @@ fn foo(x: i32) -> i32 {
134134
Using a `return` as the last line of a function works, but is considered poor
135135
style:
136136

137-
```{rust}
137+
```rust
138138
fn foo(x: i32) -> i32 {
139139
if x < 5 { return x; }
140140

@@ -160,5 +160,34 @@ fn foo(x: i32) -> i32 {
160160
Because `if` is an expression, and it's the only expression in this function,
161161
the value will be the result of the `if`.
162162

163-
There are some additional ways to define functions, but they involve features
164-
that we haven't learned about yet, so let's just leave it at that for now.
163+
## Diverging functions
164+
165+
Rust has some special syntax for 'diverging functions', which are functions that
166+
do not return:
167+
168+
```
169+
fn diverges() -> ! {
170+
panic!("This function never returns!");
171+
}
172+
```
173+
174+
`panic!` is a macro, similar to `println!()` that we've already seen. Unlike
175+
`println!()`, `panic!()` causes the current thread of execution to crash with
176+
the given message.
177+
178+
Because this function will cause a crash, it will never return, and so it has
179+
the type '`!`', which is read "diverges." A diverging function can be used
180+
as any type:
181+
182+
```should_fail
183+
# fn diverges() -> ! {
184+
# panic!("This function never returns!");
185+
# }
186+
187+
let x: i32 = diverges();
188+
let x: String = diverges();
189+
```
190+
191+
We don't have a good use for diverging functions yet, because they're used in
192+
conjunction with other Rust features. But when you see `-> !` later, you'll
193+
know what it's called.

0 commit comments

Comments
 (0)