Skip to content

Commit 33ee911

Browse files
committed
---
yaml --- r: 215030 b: refs/heads/beta c: 0b0c89e h: refs/heads/master v: v3
1 parent 88eb0da commit 33ee911

File tree

14 files changed

+263
-117
lines changed

14 files changed

+263
-117
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: ac3301ec3b71daee43a0ad5d671767d44d3280a4
26+
refs/heads/beta: 0b0c89efb37d1f7f6a72bf1a82a505cd1ca8b8eb
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 8c0aa6d64ebab528f7eb182812007155d6044972
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/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/beta/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/beta/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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ First, any borrow must last for a smaller scope than the owner. Second, you may
155155
have one or the other of these two kinds of borrows, but not both at the same
156156
time:
157157

158-
* 0 to N references (`&T`) to a resource.
158+
* one or more references (`&T`) to a resource.
159159
* exactly one mutable reference (`&mut T`)
160160

161161

branches/beta/src/libcollections/str.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,7 @@ impl str {
14661466
/// assert_eq!("bors".as_bytes(), b"bors");
14671467
/// ```
14681468
#[stable(feature = "rust1", since = "1.0.0")]
1469+
#[inline(always)]
14691470
pub fn as_bytes(&self) -> &[u8] {
14701471
core_str::StrExt::as_bytes(&self[..])
14711472
}

branches/beta/src/libcore/cell.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
//!
3939
//! * Introducing inherited mutability roots to shared types.
4040
//! * Implementation details of logically-immutable methods.
41-
//! * Mutating implementations of `clone`.
41+
//! * Mutating implementations of `Clone`.
4242
//!
4343
//! ## Introducing inherited mutability roots to shared types
4444
//!
@@ -109,7 +109,7 @@
109109
//! }
110110
//! ```
111111
//!
112-
//! ## Mutating implementations of `clone`
112+
//! ## Mutating implementations of `Clone`
113113
//!
114114
//! This is simply a special - but common - case of the previous: hiding mutability for operations
115115
//! that appear to be immutable. The `clone` method is expected to not change the source value, and

branches/beta/src/librustc/middle/check_rvalues.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for RvalueContextDelegate<'a, 'tcx> {
6060
cmt: mc::cmt<'tcx>,
6161
_: euv::ConsumeMode) {
6262
debug!("consume; cmt: {:?}; type: {}", *cmt, ty_to_string(self.tcx, cmt.ty));
63-
if !ty::type_is_sized(self.param_env, span, cmt.ty) {
63+
if !ty::type_is_sized(Some(self.param_env), self.tcx, span, cmt.ty) {
6464
span_err!(self.tcx.sess, span, E0161,
6565
"cannot move a value of type {0}: the size of {0} cannot be statically determined",
6666
ty_to_string(self.tcx, cmt.ty));

branches/beta/src/librustc/middle/intrinsicck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> {
212212
debug!("with_each_combination: space={:?}, index={}, param_ty={}",
213213
space, index, param_ty.repr(self.tcx));
214214

215-
if !ty::type_is_sized(param_env, span, param_ty) {
215+
if !ty::type_is_sized(Some(param_env), self.tcx, span, param_ty) {
216216
debug!("with_each_combination: param_ty is not known to be sized");
217217

218218
substs.types.get_mut_slice(space)[index] = self.dummy_unsized_ty;

0 commit comments

Comments
 (0)