Skip to content

Commit 9460f68

Browse files
committed
---
yaml --- r: 212574 b: refs/heads/auto c: d6b7ca0 h: refs/heads/master v: v3
1 parent eaeff01 commit 9460f68

File tree

142 files changed

+2345
-4388
lines changed

Some content is hidden

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

142 files changed

+2345
-4388
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 5ea3ed0fd0ee8c17ddfdfee58381053a849fdd03
13+
refs/heads/auto: d6b7ca041a68a9056b2295a3901800c727ccee03
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/mk/cfg/x86_64-pc-windows-msvc.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ CFG_STATIC_LIB_NAME_x86_64-pc-windows-msvc=$(1).lib
99
CFG_LIB_GLOB_x86_64-pc-windows-msvc=$(1)-*.dll
1010
CFG_LIB_DSYM_GLOB_x86_64-pc-windows-msvc=$(1)-*.dylib.dSYM
1111
CFG_JEMALLOC_CFLAGS_x86_64-pc-windows-msvc :=
12-
CFG_GCCISH_CFLAGS_x86_64-pc-windows-msvc := -MD
13-
CFG_GCCISH_CXXFLAGS_x86_64-pc-windows-msvc := -MD
12+
CFG_GCCISH_CFLAGS_x86_64-pc-windows-msvc :=
13+
CFG_GCCISH_CXXFLAGS_x86_64-pc-windows-msvc :=
1414
CFG_GCCISH_LINK_FLAGS_x86_64-pc-windows-msvc :=
1515
CFG_GCCISH_DEF_FLAG_x86_64-pc-windows-msvc :=
1616
CFG_LLC_FLAGS_x86_64-pc-windows-msvc :=

branches/auto/mk/docs.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ DOC_TARGETS += doc/not_found.html
169169
doc/not_found.html: $(D)/not_found.md $(HTML_DEPS) | doc/
170170
@$(call E, rustdoc: $@)
171171
$(Q)$(RUSTDOC) $(RUSTDOC_HTML_OPTS_NO_CSS) \
172-
--markdown-no-toc \
173172
--markdown-css http://doc.rust-lang.org/rust.css $<
174173

175174
define DEF_DOC

branches/auto/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
651651

652652
// Write debugger script:
653653
// We don't want to hang when calling `quit` while the process is still running
654-
let mut script_str = String::from("settings set auto-confirm true\n");
654+
let mut script_str = String::from_str("settings set auto-confirm true\n");
655655

656656
// Make LLDB emit its version, so we have it documented in the test output
657657
script_str.push_str("version\n");

branches/auto/src/doc/not_found.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ Looks like you've taken a wrong turn.
1111

1212
Some things that might be helpful to you though:
1313

14-
# Search
14+
## Search
1515

1616
* <form action="https://duckduckgo.com/">
1717
<input type="text" id="site-search" name="q" size="80"></input>
1818
<input type="submit" value="Search DuckDuckGo">
1919
</form>
2020
* Rust doc search: <span id="core-search"></span>
2121

22-
# Reference
22+
## Reference
2323

2424
* [The Rust official site](http://rust-lang.org)
2525
* [The Rust reference](http://doc.rust-lang.org/reference.html)
2626

27-
# Docs
27+
## Docs
2828

2929
* [The standard library](http://doc.rust-lang.org/std/)
3030

branches/auto/src/doc/reference.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ be undesired.
10381038

10391039
* Deadlocks
10401040
* Reading data from private fields (`std::repr`)
1041-
* Leaks of memory and other resources
1041+
* Leaks due to reference count cycles, even in the global heap
10421042
* Exiting without calling destructors
10431043
* Sending signals
10441044
* Accessing/modifying the file system
@@ -1367,6 +1367,7 @@ Traits can include default implementations of methods, as in:
13671367
```
13681368
trait Foo {
13691369
fn bar(&self);
1370+
13701371
fn baz(&self) { println!("We called baz."); }
13711372
}
13721373
```
@@ -1417,13 +1418,9 @@ impl<T> Container for Vec<T> {
14171418
```
14181419

14191420
Generic functions may use traits as _bounds_ on their type parameters. This
1420-
will have two effects:
1421-
1422-
- Only types that have the trait may instantiate the parameter.
1423-
- Within the generic function, the methods of the trait can be
1424-
called on values that have the parameter's type.
1425-
1426-
For example:
1421+
will have two effects: only types that have the trait may instantiate the
1422+
parameter, and within the generic function, the methods of the trait can be
1423+
called on values that have the parameter's type. For example:
14271424

14281425
```
14291426
# type Surface = i32;
@@ -2834,13 +2831,13 @@ on the right-hand side.
28342831
An example of an `as` expression:
28352832

28362833
```
2837-
# fn sum(values: &[f64]) -> f64 { 0.0 }
2838-
# fn len(values: &[f64]) -> i32 { 0 }
2834+
# fn sum(v: &[f64]) -> f64 { 0.0 }
2835+
# fn len(v: &[f64]) -> i32 { 0 }
28392836
2840-
fn average(values: &[f64]) -> f64 {
2841-
let sum: f64 = sum(values);
2842-
let size: f64 = len(values) as f64;
2843-
sum / size
2837+
fn avg(v: &[f64]) -> f64 {
2838+
let sum: f64 = sum(v);
2839+
let sz: f64 = len(v) as f64;
2840+
return sum / sz;
28442841
}
28452842
```
28462843

branches/auto/src/doc/trpl/closures.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ let plus_two = |x| {
3333
assert_eq!(4, plus_two(2));
3434
```
3535

36-
You’ll notice a few things about closures that are a bit different from regular
37-
functions defined with `fn`. The first is that we did not need to
36+
You’ll notice a few things about closures that are a bit different than regular
37+
functions defined with `fn`. The first of which is that we did not need to
3838
annotate the types of arguments the closure takes or the values it returns. We
3939
can:
4040

@@ -48,18 +48,18 @@ But we don’t have to. Why is this? Basically, it was chosen for ergonomic reas
4848
While specifying the full type for named functions is helpful with things like
4949
documentation and type inference, the types of closures are rarely documented
5050
since they’re anonymous, and they don’t cause the kinds of error-at-a-distance
51-
problems that inferring named function types can.
51+
that inferring named function types can.
5252

5353
The second is that the syntax is similar, but a bit different. I’ve added spaces
54-
here for easier comparison:
54+
here to make them look a little closer:
5555

5656
```rust
5757
fn plus_one_v1 (x: i32) -> i32 { x + 1 }
5858
let plus_one_v2 = |x: i32| -> i32 { x + 1 };
5959
let plus_one_v3 = |x: i32| x + 1 ;
6060
```
6161

62-
Small differences, but they’re similar.
62+
Small differences, but they’re similar in ways.
6363

6464
# Closures and their environment
6565

@@ -99,7 +99,7 @@ note: previous borrow ends here
9999
fn main() {
100100
let mut num = 5;
101101
let plus_num = |x| x + num;
102-
102+
103103
let y = &mut num;
104104
}
105105
^
@@ -161,7 +161,7 @@ of `num`. So what’s the difference?
161161
```rust
162162
let mut num = 5;
163163

164-
{
164+
{
165165
let mut add_num = |x: i32| num += x;
166166

167167
add_num(5);
@@ -180,7 +180,7 @@ If we change to a `move` closure, it’s different:
180180
```rust
181181
let mut num = 5;
182182

183-
{
183+
{
184184
let mut add_num = move |x: i32| num += x;
185185

186186
add_num(5);

branches/auto/src/doc/trpl/comments.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ The other kind of comment is a doc comment. Doc comments use `///` instead of
2929
/// let five = 5;
3030
///
3131
/// assert_eq!(6, add_one(5));
32-
/// # fn add_one(x: i32) -> i32 {
33-
/// # x + 1
34-
/// # }
3532
/// ```
3633
fn add_one(x: i32) -> i32 {
3734
x + 1

branches/auto/src/doc/trpl/const-and-static.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ unsafe {
6464

6565
[unsafe]: unsafe.html
6666

67-
Furthermore, any type stored in a `static` must be `Sync`, and may not have
68-
a [`Drop`][drop] implementation.
69-
70-
[drop]: drop.html
67+
Furthermore, any type stored in a `static` must be `Sync`.
7168

7269
# Initializing
7370

@@ -81,3 +78,7 @@ Almost always, if you can choose between the two, choose `const`. It’s pretty
8178
rare that you actually want a memory location associated with your constant,
8279
and using a const allows for optimizations like constant propagation not only
8380
in your crate but downstream crates.
81+
82+
A const can be thought of as a `#define` in C: it has metadata overhead but it
83+
has no runtime overhead. “Should I use a #define or a static in C,” is largely
84+
the same question as whether you should use a const or a static in Rust.

branches/auto/src/doc/trpl/dining-philosophers.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,7 @@ an extra annotation, `move`, to indicate that the closure is going to take
432432
ownership of the values it’s capturing. Primarily, the `p` variable of the
433433
`map` function.
434434

435-
Inside the thread, all we do is call `eat()` on `p`. Also note that the call to `thread::spawn` lacks a trailing semicolon, making this an expression. This distinction is important, yielding the correct return value. For more details, read [Expressions vs. Statements][es].
436-
437-
[es]: functions.html#expressions-vs.-statements
435+
Inside the thread, all we do is call `eat()` on `p`.
438436

439437
```rust,ignore
440438
}).collect();
@@ -674,13 +672,9 @@ let handles: Vec<_> = philosophers.into_iter().map(|p| {
674672

675673
Finally, inside of our `map()`/`collect()` loop, we call `table.clone()`. The
676674
`clone()` method on `Arc<T>` is what bumps up the reference count, and when it
677-
goes out of scope, it decrements the count. This is needed so that we know how
678-
many references to `table` exist across our threads. If we didn’t have a count,
679-
we wouldn’t know how to deallocate it.
680-
681-
You’ll notice we can introduce a new binding to `table` here, and it will
682-
shadow the old one. This is often used so that you don’t need to come up with
683-
two unique names.
675+
goes out of scope, it decrements the count. You’ll notice we can introduce a
676+
new binding to `table` here, and it will shadow the old one. This is often used
677+
so that you don’t need to come up with two unique names.
684678

685679
With this, our program works! Only two philosophers can eat at any one time,
686680
and so you’ll get some output like this:

branches/auto/src/doc/trpl/error-handling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ struct Info {
284284
}
285285

286286
fn write_info(info: &Info) -> io::Result<()> {
287-
let mut file = File::create("my_best_friends.txt").unwrap();
287+
let mut file = try!(File::create("my_best_friends.txt"));
288288

289289
try!(writeln!(&mut file, "name: {}", info.name));
290290
try!(writeln!(&mut file, "age: {}", info.age));

branches/auto/src/doc/trpl/ffi.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,8 @@ Note that frameworks are only available on OSX targets.
342342
The different `kind` values are meant to differentiate how the native library
343343
participates in linkage. From a linkage perspective, the rust compiler creates
344344
two flavors of artifacts: partial (rlib/staticlib) and final (dylib/binary).
345-
Native dynamic library and framework dependencies are propagated to the final
346-
artifact boundary, while static library dependencies are not propagated at
347-
all, because the static libraries are integrated directly into the subsequent
348-
artifact.
345+
Native dynamic libraries and frameworks are propagated to the final artifact
346+
boundary, while static libraries are not propagated at all.
349347
350348
A few examples of how this model can be used are:
351349

branches/auto/src/doc/trpl/generics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
% Generics
22

33
Sometimes, when writing a function or data type, we may want it to work for
4-
multiple types of arguments. In Rust, we can do this with generics.
5-
Generics are called ‘parametric polymorphism’ in type theory,
4+
multiple types of arguments. Luckily, Rust has a feature that gives us a better
5+
way: generics. Generics are called ‘parametric polymorphism’ in type theory,
66
which means that they are types or functions that have multiple forms (‘poly’
77
is multiple, ‘morph’ is form) over a given parameter (‘parametric’).
88

branches/auto/src/doc/trpl/hello-cargo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Note that since we're creating an executable, we used `main.rs`. If we
3636
want to make a library instead, we should use `lib.rs`. This convention is required
3737
for Cargo to successfully compile our projects, but it can be overridden if we wish.
3838
Custom file locations for the entry point can be specified
39-
with a [`[lib]` or `[[bin]]`][crates-custom] key in the TOML file.
39+
with a [`[[lib]]` or `[[bin]]`][crates-custom] key in the TOML file described below.
4040

4141
[crates-custom]: http://doc.crates.io/manifest.html#configuring-a-target
4242

@@ -170,7 +170,7 @@ This is all we need to get started. First, let’s check out `Cargo.toml`:
170170
[package]
171171

172172
name = "hello_world"
173-
version = "0.1.0"
173+
version = "0.0.1"
174174
authors = ["Your Name <[email protected]>"]
175175
```
176176

branches/auto/src/doc/trpl/method-syntax.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ impl Circle {
8686
# Chaining method calls
8787

8888
So, now we know how to call a method, such as `foo.bar()`. But what about our
89-
original example, `foo.bar().baz()`? This is called ‘method chaining’. Let’s
90-
look at an example:
89+
original example, `foo.bar().baz()`? This is called ‘method chaining’, and we
90+
can do it by returning `self`.
9191

9292
```rust
9393
struct Circle {

branches/auto/src/doc/trpl/ownership.md

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -156,46 +156,6 @@ that, just like a move, when we assign `v` to `v2`, a copy of the data is made.
156156
But, unlike a move, we can still use `v` afterward. This is because an `i32`
157157
has no pointers to data somewhere else, copying it is a full copy.
158158

159-
All primitive types implement the `Copy` trait and their ownership is
160-
therefore not moved like one would assume, following the ´ownership rules´.
161-
To give an example, the two following snippets of code only compile because the
162-
`i32` and `bool` types implement the `Copy` trait.
163-
164-
```rust
165-
fn main() {
166-
let a = 5;
167-
168-
let _y = double(a);
169-
println!("{}", a);
170-
}
171-
172-
fn double(x: i32) -> i32 {
173-
x * 2
174-
}
175-
```
176-
177-
```rust
178-
fn main() {
179-
let a = true;
180-
181-
let _y = change_truth(a);
182-
println!("{}", a);
183-
}
184-
185-
fn change_truth(x: bool) -> bool {
186-
!x
187-
}
188-
```
189-
190-
If we would have used types that do not implement the `Copy` trait,
191-
we would have gotten a compile error because we tried to use a moved value.
192-
193-
```text
194-
error: use of moved value: `a`
195-
println!("{}", a);
196-
^
197-
```
198-
199159
We will discuss how to make your own types `Copy` in the [traits][traits]
200160
section.
201161

branches/auto/src/doc/trpl/patterns.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -154,31 +154,6 @@ match x {
154154

155155
This prints `Got an int!`.
156156

157-
If you’re using `if` with multiple patterns, the `if` applies to both sides:
158-
159-
```rust
160-
let x = 4;
161-
let y = false;
162-
163-
match x {
164-
4 | 5 if y => println!("yes"),
165-
_ => println!("no"),
166-
}
167-
```
168-
169-
This prints `no`, because the `if` applies to the whole of `4 | 5`, and not to
170-
just the `5`, In other words, the the precedence of `if` behaves like this:
171-
172-
```text
173-
(4 | 5) if y => ...
174-
```
175-
176-
not this:
177-
178-
```text
179-
4 | (5 if y) => ...
180-
```
181-
182157
# ref and ref mut
183158

184159
If you want to get a [reference][ref], use the `ref` keyword:

branches/auto/src/doc/trpl/references-and-borrowing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ As it turns out, there are rules.
151151

152152
Here’s the rules about borrowing in Rust:
153153

154-
First, any borrow must last for a scope no greater than that of the owner.
155-
Second, you may have one or the other of these two kinds of borrows, but not
156-
both at the same time:
154+
First, any borrow must last for a smaller scope than the owner. Second, you may
155+
have one or the other of these two kinds of borrows, but not both at the same
156+
time:
157157

158158
* one or more references (`&T`) to a resource.
159159
* exactly one mutable reference (`&mut T`)

0 commit comments

Comments
 (0)