Skip to content

Commit 280f9bc

Browse files
committed
---
yaml --- r: 212694 b: refs/heads/tmp c: fd2c76c h: refs/heads/master v: v3
1 parent 97fd0d4 commit 280f9bc

File tree

130 files changed

+1431
-747
lines changed

Some content is hidden

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

130 files changed

+1431
-747
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: 4efc4ec178f6ddf3c8cd268b011f3a04056f9d16
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: 76102b0aa7731574ac0b0882fe45dd6ce81b4031
35+
refs/heads/tmp: fd2c76cd947ac28f9394cf533db0218473f39f36
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: bea1c4a78e5233ea6f85a2028a26e08c26635fca
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/configure

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,12 @@ 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
13101316

13111317
if [ -z $CFG_LLVM_ROOT ]
13121318
then
@@ -1326,7 +1332,13 @@ do
13261332
LLVM_ASSERTION_OPTS="--disable-assertions"
13271333
else
13281334
LLVM_ASSERTION_OPTS="--enable-assertions"
1329-
LLVM_INST_DIR=${LLVM_INST_DIR}+Asserts
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
13301342
fi
13311343
else
13321344
msg "not reconfiguring LLVM, external LLVM root"
@@ -1356,14 +1368,7 @@ do
13561368
done
13571369
fi
13581370

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 ]
1371+
if [ ${do_reconfigure} -ne 0 ] && [ ${is_msvc} -ne 0 ]
13671372
then
13681373
msg "configuring LLVM for $t with cmake"
13691374

@@ -1388,7 +1393,7 @@ do
13881393
need_ok "LLVM cmake configure failed"
13891394
fi
13901395

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

branches/tmp/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_str("settings set auto-confirm true\n");
654+
let mut script_str = String::from("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/tmp/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](http://irc.mozilla.org/) are the
28+
The Rust IRC channels on [irc.mozilla.org](irc://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](http://stackoverflow.com/questions/tagged/rust). Searching for your
43+
Overflow](https://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](http://reddit.com/r/rust) with lots of
46+
There is an active [subreddit](https://reddit.com/r/rust) with lots of
4747
discussion and news about Rust.
4848

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
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
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](http://crates.io) is Rust's package manager, and its website contains
64+
[Cargo](https://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.

branches/tmp/src/doc/reference.md

Lines changed: 8 additions & 4 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 due to reference count cycles, even in the global heap
1041+
* Leaks of memory and other resources
10421042
* Exiting without calling destructors
10431043
* Sending signals
10441044
* Accessing/modifying the file system
@@ -1418,9 +1418,13 @@ 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: 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:
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:
14241428

14251429
```
14261430
# type Surface = i32;

branches/tmp/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 than regular
37-
functions defined with `fn`. The first of which is that we did not need to
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
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-
that inferring named function types can.
51+
problems 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 to make them look a little closer:
54+
here for easier comparison:
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 in ways.
62+
Small differences, but they’re similar.
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/tmp/src/doc/trpl/comments.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ 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+
/// # }
3235
/// ```
3336
fn add_one(x: i32) -> i32 {
3437
x + 1

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,9 @@ 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`.
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
436438

437439
```rust,ignore
438440
}).collect();

branches/tmp/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 = try!(File::create("my_best_friends.txt"));
287+
let mut file = File::create("my_best_friends.txt").unwrap();
288288

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

branches/tmp/src/doc/trpl/for-loops.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,45 @@ 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+
```

branches/tmp/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. Luckily, Rust has a feature that gives us a better
5-
way: generics. Generics are called ‘parametric polymorphism’ in type theory,
4+
multiple types of arguments. In Rust, we can do this with generics.
5+
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/tmp/src/doc/trpl/hello-cargo.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ $ 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`.
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.
3738
Custom file locations for the entry point can be specified
38-
with a [`[[lib]]` or `[[bin]]`][crates-custom] key in the TOML file described below.
39+
with a [`[lib]` or `[[bin]]`][crates-custom] key in the TOML file.
3940

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

@@ -62,18 +63,17 @@ version = "0.0.1"
6263
authors = [ "Your name <[email protected]>" ]
6364
```
6465

65-
This file is in the [TOML][toml] format. Let’s let it explain itself to you:
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,
6668

6769
> TOML aims to be a minimal configuration file format that's easy to read due
6870
> to obvious semantics. TOML is designed to map unambiguously to a hash table.
6971
> TOML should be easy to parse into data structures in a wide variety of
7072
> languages.
7173
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! Try this:
76+
Once you have this file in place, we should be ready to build! To do so, run:
7777

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

85-
Bam! We build our project with `cargo build`, and run it with
85+
Bam! We built our project with `cargo build`, and ran 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 would need to do more
106+
about the future: when our project gets more complex, we 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 `cargo build`, and it’ll work the right way.
108+
grows, we can just run `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-
This file is used by Cargo to keep track of dependencies in your application.
121+
The `Cargo.lock` 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.0.1"
173+
version = "0.1.0"
174174
authors = ["Your Name <[email protected]>"]
175175
```
176176

branches/tmp/src/doc/trpl/macros.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ more" match. Both forms optionally include a separator, which can be any token
224224
except `+` or `*`.
225225

226226
This system is based on
227-
"[Macro-by-Example](http://www.cs.indiana.edu/ftp/techreports/TR206.pdf)"
227+
"[Macro-by-Example](https://www.cs.indiana.edu/ftp/techreports/TR206.pdf)"
228228
(PDF link).
229229

230230
# Hygiene
@@ -319,7 +319,7 @@ syntax context where it was introduced. It’s as though the variable `state`
319319
inside `main` is painted a different "color" from the variable `state` inside
320320
the macro, and therefore they don’t conflict.
321321

322-
[hygienic macro system]: http://en.wikipedia.org/wiki/Hygienic_macro
322+
[hygienic macro system]: https://en.wikipedia.org/wiki/Hygienic_macro
323323

324324
This also restricts the ability of macros to introduce new bindings at the
325325
invocation site. Code such as the following will not work:
@@ -622,7 +622,7 @@ invocation gives you another opportunity to pattern-match the macro’s
622622
arguments.
623623

624624
As an extreme example, it is possible, though hardly advisable, to implement
625-
the [Bitwise Cyclic Tag](http://esolangs.org/wiki/Bitwise_Cyclic_Tag) automaton
625+
the [Bitwise Cyclic Tag](https://esolangs.org/wiki/Bitwise_Cyclic_Tag) automaton
626626
within Rust’s macro system.
627627

628628
```rust

0 commit comments

Comments
 (0)