Skip to content

Commit 52202dc

Browse files
author
Ulrik Sverdrup
committed
---
yaml --- r: 212377 b: refs/heads/master c: 2b50c15 h: refs/heads/master i: 212375: 0e45dcb v: v3
1 parent fed1533 commit 52202dc

File tree

129 files changed

+1446
-2385
lines changed

Some content is hidden

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

129 files changed

+1446
-2385
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: 6daf1dcb80e324df94ad4a1d263c832ab589b33a
2+
refs/heads/master: 2b50c157d62f566fc367693cd15d55568fb5e33e
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
55
refs/heads/try: 1864973ae17213c5a58c4dd3f9af6d1b6c7d2e05

trunk/configure

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,12 +1307,6 @@ CFG_LLVM_SRC_DIR=${CFG_SRC_DIR}src/llvm/
13071307
for t in $CFG_HOST
13081308
do
13091309
do_reconfigure=1
1310-
is_msvc=0
1311-
case "$t" in
1312-
(*-msvc)
1313-
is_msvc=1
1314-
;;
1315-
esac
13161310

13171311
if [ -z $CFG_LLVM_ROOT ]
13181312
then
@@ -1332,13 +1326,7 @@ do
13321326
LLVM_ASSERTION_OPTS="--disable-assertions"
13331327
else
13341328
LLVM_ASSERTION_OPTS="--enable-assertions"
1335-
1336-
# Apparently even if we request assertions be enabled for MSVC,
1337-
# LLVM's CMake build system ignore this and outputs in `Release`
1338-
# anyway.
1339-
if [ ${is_msvc} -eq 0 ]; then
1340-
LLVM_INST_DIR=${LLVM_INST_DIR}+Asserts
1341-
fi
1329+
LLVM_INST_DIR=${LLVM_INST_DIR}+Asserts
13421330
fi
13431331
else
13441332
msg "not reconfiguring LLVM, external LLVM root"
@@ -1368,7 +1356,14 @@ do
13681356
done
13691357
fi
13701358

1371-
if [ ${do_reconfigure} -ne 0 ] && [ ${is_msvc} -ne 0 ]
1359+
use_cmake=0
1360+
case "$t" in
1361+
(*-msvc)
1362+
use_cmake=1
1363+
;;
1364+
esac
1365+
1366+
if [ ${do_reconfigure} -ne 0 ] && [ ${use_cmake} -ne 0 ]
13721367
then
13731368
msg "configuring LLVM for $t with cmake"
13741369

@@ -1393,7 +1388,7 @@ do
13931388
need_ok "LLVM cmake configure failed"
13941389
fi
13951390

1396-
if [ ${do_reconfigure} -ne 0 ] && [ ${is_msvc} -eq 0 ]
1391+
if [ ${do_reconfigure} -ne 0 ] && [ ${use_cmake} -eq 0 ]
13971392
then
13981393
# LLVM's configure doesn't recognize the new Windows triples yet
13991394
gnu_t=$(to_gnu_triple $t)

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/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ series of small examples.
2525
If you need help with something, or just want to talk about Rust with others,
2626
there are a few places you can do that:
2727

28-
The Rust IRC channels on [irc.mozilla.org](irc://irc.mozilla.org/) are the
28+
The Rust IRC channels on [irc.mozilla.org](http://irc.mozilla.org/) are the
2929
fastest way to get help.
3030
[`#rust`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust) is
3131
the general discussion channel, and you'll find people willing to help you with
@@ -40,15 +40,15 @@ There's also
4040
[`#rust-internals`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals), which is for discussion of the development of Rust itself.
4141

4242
You can also get help on [Stack
43-
Overflow](https://stackoverflow.com/questions/tagged/rust). Searching for your
43+
Overflow](http://stackoverflow.com/questions/tagged/rust). Searching for your
4444
problem might reveal someone who has asked it before!
4545

46-
There is an active [subreddit](https://reddit.com/r/rust) with lots of
46+
There is an active [subreddit](http://reddit.com/r/rust) with lots of
4747
discussion and news about Rust.
4848

49-
There is also a [user forum](https://users.rust-lang.org), for all
50-
user-oriented discussion, and a [developer
51-
forum](https://internals.rust-lang.org/), where the development of Rust
49+
There is also a [user forum](http://users.rust-lang.org), for all
50+
user-oriented discussion, and a [developer
51+
forum](http://internals.rust-lang.org/), where the development of Rust
5252
itself is discussed.
5353

5454
# Specification
@@ -61,7 +61,7 @@ the language in as much detail as possible is in [the reference](reference.html)
6161
Rust is still a young language, so there isn't a ton of tooling yet, but the
6262
tools we have are really nice.
6363

64-
[Cargo](https://crates.io) is Rust's package manager, and its website contains
64+
[Cargo](http://crates.io) is Rust's package manager, and its website contains
6565
lots of good documentation.
6666

6767
[`rustdoc`](book/documentation.html) is used to generate documentation for Rust code.

trunk/src/doc/reference.md

Lines changed: 10 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
@@ -1418,13 +1418,9 @@ impl<T> Container for Vec<T> {
14181418
```
14191419

14201420
Generic functions may use traits as _bounds_ on their type parameters. This
1421-
will have two effects:
1422-
1423-
- Only types that have the trait may instantiate the parameter.
1424-
- Within the generic function, the methods of the trait can be
1425-
called on values that have the parameter's type.
1426-
1427-
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:
14281424

14291425
```
14301426
# type Surface = i32;
@@ -2835,13 +2831,13 @@ on the right-hand side.
28352831
An example of an `as` expression:
28362832

28372833
```
2838-
# fn sum(values: &[f64]) -> f64 { 0.0 }
2839-
# fn len(values: &[f64]) -> i32 { 0 }
2834+
# fn sum(v: &[f64]) -> f64 { 0.0 }
2835+
# fn len(v: &[f64]) -> i32 { 0 }
28402836
2841-
fn average(values: &[f64]) -> f64 {
2842-
let sum: f64 = sum(values);
2843-
let size: f64 = len(values) as f64;
2844-
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;
28452841
}
28462842
```
28472843

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/dining-philosophers.md

Lines changed: 1 addition & 3 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();

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/for-loops.md

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -41,45 +41,3 @@ so our loop will print `0` through `9`, not `10`.
4141
Rust does not have the “C-style” `for` loop on purpose. Manually controlling
4242
each element of the loop is complicated and error prone, even for experienced C
4343
developers.
44-
45-
# Enumerate
46-
47-
When you need to keep track of how many times you already looped, you can use the `.enumerate()` function.
48-
49-
## On ranges:
50-
51-
```rust
52-
for (i,j) in (5..10).enumerate() {
53-
println!("i = {} and j = {}", i, j);
54-
}
55-
```
56-
57-
Outputs:
58-
59-
```text
60-
i = 0 and j = 5
61-
i = 1 and j = 6
62-
i = 2 and j = 7
63-
i = 3 and j = 8
64-
i = 4 and j = 9
65-
```
66-
67-
Don't forget to add the parentheses around the range.
68-
69-
## On iterators:
70-
71-
```rust
72-
# let lines = "hello\nworld".lines();
73-
for (linenumber, line) in lines.enumerate() {
74-
println!("{}: {}", linenumber, line);
75-
}
76-
```
77-
78-
Outputs:
79-
80-
```text
81-
0: Content of line one
82-
1: Content of line two
83-
2: Content of line tree
84-
3: Content of line four
85-
```

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

trunk/src/doc/trpl/hello-cargo.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ $ mv main.rs src/main.rs
3333
```
3434

3535
Note that since we're creating an executable, we used `main.rs`. If we
36-
want to make a library instead, we should use `lib.rs`. This convention is required
37-
for Cargo to successfully compile our projects, but it can be overridden if we wish.
36+
want to make a library instead, we should use `lib.rs`.
3837
Custom file locations for the entry point can be specified
39-
with a [`[lib]` or `[[bin]]`][crates-custom] key in the TOML file.
38+
with a [`[[lib]]` or `[[bin]]`][crates-custom] key in the TOML file described below.
4039

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

@@ -63,17 +62,18 @@ version = "0.0.1"
6362
authors = [ "Your name <[email protected]>" ]
6463
```
6564

66-
This file is in the [TOML][toml] format. TOML is similar to INI, but has some
67-
extra goodies. According to the TOML docs,
65+
This file is in the [TOML][toml] format. Let’s let it explain itself to you:
6866

6967
> TOML aims to be a minimal configuration file format that's easy to read due
7068
> to obvious semantics. TOML is designed to map unambiguously to a hash table.
7169
> TOML should be easy to parse into data structures in a wide variety of
7270
> languages.
7371
72+
TOML is very similar to INI, but with some extra goodies.
73+
7474
[toml]: https://github.com/toml-lang/toml
7575

76-
Once you have this file in place, we should be ready to build! To do so, run:
76+
Once you have this file in place, we should be ready to build! Try this:
7777

7878
```bash
7979
$ cargo build
@@ -82,7 +82,7 @@ $ ./target/debug/hello_world
8282
Hello, world!
8383
```
8484

85-
Bam! We built our project with `cargo build`, and ran it with
85+
Bam! We build our project with `cargo build`, and run it with
8686
`./target/debug/hello_world`. We can do both in one step with `cargo run`:
8787

8888
```bash
@@ -103,9 +103,9 @@ Hello, world!
103103
```
104104

105105
This hasn’t bought us a whole lot over our simple use of `rustc`, but think
106-
about the future: when our project gets more complex, we need to do more
106+
about the future: when our project gets more complex, we would need to do more
107107
things to get all of the parts to properly compile. With Cargo, as our project
108-
grows, we can just run `cargo build`, and it’ll work the right way.
108+
grows, we can just `cargo build`, and it’ll work the right way.
109109

110110
When your project is finally ready for release, you can use
111111
`cargo build --release` to compile your project with optimizations.
@@ -118,7 +118,7 @@ name = "hello_world"
118118
version = "0.0.1"
119119
```
120120

121-
The `Cargo.lock` file is used by Cargo to keep track of dependencies in your application.
121+
This file is used by Cargo to keep track of dependencies in your application.
122122
Right now, we don’t have any, so it’s a bit sparse. You won't ever need
123123
to touch this file yourself, just let Cargo handle it.
124124

@@ -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

0 commit comments

Comments
 (0)