Skip to content

Commit 3f09497

Browse files
committed
---
yaml --- r: 212445 b: refs/heads/master c: 97294be h: refs/heads/master i: 212443: c264ce2 v: v3
1 parent 9d25831 commit 3f09497

File tree

204 files changed

+2352
-4915
lines changed

Some content is hidden

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

204 files changed

+2352
-4915
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: db0c1cb13c9a1e68c09e2074b6d3a7b38122fb76
2+
refs/heads/master: 97294be30c8712a91060d0ce043adefb4f867db8
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
55
refs/heads/try: 1864973ae17213c5a58c4dd3f9af6d1b6c7d2e05

trunk/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 :=

trunk/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

trunk/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");

trunk/src/doc/grammar.md

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

283283
```antlr
284-
expr_macro_rules : "macro_rules" '!' ident '(' macro_rule * ')' ';'
285-
| "macro_rules" '!' ident '{' macro_rule * '}' ;
284+
expr_macro_rules : "macro_rules" '!' ident '(' macro_rule * ')' ;
286285
macro_rule : '(' matcher * ')' "=>" '(' transcriber * ')' ';' ;
287286
matcher : '(' matcher * ')' | '[' matcher * ']'
288287
| '{' matcher * '}' | '$' ident ':' ident

trunk/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

trunk/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

trunk/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);

trunk/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

trunk/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.

trunk/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:

trunk/src/doc/trpl/enums.md

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -64,45 +64,3 @@ equality yet, but we’ll find out in the [`traits`][traits] section.
6464
[match]: match.html
6565
[if-let]: if-let.html
6666
[traits]: traits.html
67-
68-
# Constructors as functions
69-
70-
An enum’s constructors can also be used like functions. For example:
71-
72-
```rust
73-
# enum Message {
74-
# Write(String),
75-
# }
76-
let m = Message::Write("Hello, world".to_string());
77-
```
78-
79-
Is the same as
80-
81-
```rust
82-
# enum Message {
83-
# Write(String),
84-
# }
85-
fn foo(x: String) -> Message {
86-
Message::Write(x)
87-
}
88-
89-
let x = foo("Hello, world".to_string());
90-
```
91-
92-
This is not immediately useful to us, but when we get to
93-
[`closures`][closures], we’ll talk about passing functions as arguments to
94-
other functions. For example, with [`iterators`][iterators], we can do this
95-
to convert a vector of `String`s into a vector of `Message::Write`s:
96-
97-
```rust
98-
# enum Message {
99-
# Write(String),
100-
# }
101-
102-
let v = vec!["Hello".to_string(), "World".to_string()];
103-
104-
let v1: Vec<Message> = v.into_iter().map(Message::Write).collect();
105-
```
106-
107-
[closures]: closures.html
108-
[iterators]: iterators.html

trunk/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));

trunk/src/doc/trpl/ffi.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ However it is often desired that the callback is targeted to a special
238238
Rust object. This could be the object that represents the wrapper for the
239239
respective C object.
240240
241-
This can be achieved by passing an raw pointer to the object down to the
241+
This can be achieved by passing an unsafe pointer to the object down to the
242242
C library. The C library can then include the pointer to the Rust object in
243243
the notification. This will allow the callback to unsafely access the
244244
referenced Rust object.
@@ -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
@@ -370,7 +368,7 @@ On OSX, frameworks behave with the same semantics as a dynamic library.
370368
371369
# Unsafe blocks
372370
373-
Some operations, like dereferencing raw pointers or calling functions that have been marked
371+
Some operations, like dereferencing unsafe pointers or calling functions that have been marked
374372
unsafe are only allowed inside unsafe blocks. Unsafe blocks isolate unsafety and are a promise to
375373
the compiler that the unsafety does not leak out of the block.
376374

trunk/src/doc/trpl/functions.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ an expression, and a `let` can only begin a statement, not an expression.
144144
Note that assigning to an already-bound variable (e.g. `y = 5`) is still an
145145
expression, although its value is not particularly useful. Unlike other
146146
languages where an assignment evaluates to the assigned value (e.g. `5` in the
147-
previous example), in Rust the value of an assignment is an empty tuple `()`
148-
because the assigned value can have [just one owner](ownership.html), and any
149-
other returned value would be too surprising:
147+
previous example), in Rust the value of an assignment is an empty tuple `()`:
150148

151149
```rust
152150
let mut y = 5;

trunk/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

0 commit comments

Comments
 (0)