Skip to content

Commit 19a3971

Browse files
committed
Auto merge of #26028 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #25925, #26001, #26010, #26011, #26017, #26020 - Failed merges:
2 parents ef72938 + eb6a70c commit 19a3971

File tree

7 files changed

+139
-48
lines changed

7 files changed

+139
-48
lines changed

src/doc/index.md

+7-7
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.

src/doc/trpl/for-loops.md

+42
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+
```

src/doc/trpl/macros.md

+3-3
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

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

+1-1
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

src/libcore/cell.rs

+2-2
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

src/librustdoc/html/markdown.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
252252
s.push_str(&format!("<span class='rusttest'>{}</span>", Escape(&test)));
253253
});
254254
s.push_str(&highlight::highlight(&text,
255-
None,
256-
Some("rust-example-rendered")));
255+
Some("rust-example-rendered"),
256+
None));
257257
let output = CString::new(s).unwrap();
258258
hoedown_buffer_puts(ob, output.as_ptr());
259259
})

src/libstd/os/android/raw.rs

+82-33
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,86 @@
1010

1111
//! Android-specific raw type definitions
1212
13-
use os::raw::{c_uint, c_uchar, c_ulonglong, c_longlong, c_ulong};
14-
use os::unix::raw::{uid_t, gid_t};
15-
16-
pub type blkcnt_t = u32;
17-
pub type blksize_t = u32;
18-
pub type dev_t = u32;
19-
pub type ino_t = u32;
20-
pub type mode_t = u16;
21-
pub type nlink_t = u16;
22-
pub type off_t = i32;
23-
pub type time_t = i32;
24-
25-
#[repr(C)]
26-
pub struct stat {
27-
pub st_dev: c_ulonglong,
28-
pub __pad0: [c_uchar; 4],
29-
pub __st_ino: ino_t,
30-
pub st_mode: c_uint,
31-
pub st_nlink: c_uint,
32-
pub st_uid: uid_t,
33-
pub st_gid: gid_t,
34-
pub st_rdev: c_ulonglong,
35-
pub __pad3: [c_uchar; 4],
36-
pub st_size: c_longlong,
37-
pub st_blksize: blksize_t,
38-
pub st_blocks: c_ulonglong,
39-
pub st_atime: time_t,
40-
pub st_atime_nsec: c_ulong,
41-
pub st_mtime: time_t,
42-
pub st_mtime_nsec: c_ulong,
43-
pub st_ctime: time_t,
44-
pub st_ctime_nsec: c_ulong,
45-
pub st_ino: c_ulonglong,
13+
#[doc(inline)]
14+
pub use self::arch::{dev_t, mode_t, blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t};
15+
16+
#[cfg(target_arch = "arm")]
17+
mod arch {
18+
use os::raw::{c_uint, c_uchar, c_ulonglong, c_longlong, c_ulong};
19+
use os::unix::raw::{uid_t, gid_t};
20+
21+
pub type dev_t = u32;
22+
pub type mode_t = u16;
23+
24+
pub type blkcnt_t = u32;
25+
pub type blksize_t = u32;
26+
pub type ino_t = u32;
27+
pub type nlink_t = u16;
28+
pub type off_t = i32;
29+
pub type time_t = i32;
30+
31+
#[repr(C)]
32+
pub struct stat {
33+
pub st_dev: c_ulonglong,
34+
pub __pad0: [c_uchar; 4],
35+
pub __st_ino: ino_t,
36+
pub st_mode: c_uint,
37+
pub st_nlink: c_uint,
38+
pub st_uid: uid_t,
39+
pub st_gid: gid_t,
40+
pub st_rdev: c_ulonglong,
41+
pub __pad3: [c_uchar; 4],
42+
pub st_size: c_longlong,
43+
pub st_blksize: blksize_t,
44+
pub st_blocks: c_ulonglong,
45+
pub st_atime: time_t,
46+
pub st_atime_nsec: c_ulong,
47+
pub st_mtime: time_t,
48+
pub st_mtime_nsec: c_ulong,
49+
pub st_ctime: time_t,
50+
pub st_ctime_nsec: c_ulong,
51+
pub st_ino: c_ulonglong,
52+
}
53+
54+
}
55+
56+
57+
#[cfg(target_arch = "aarch64")]
58+
mod arch {
59+
use os::raw::{c_uchar, c_ulong};
60+
use os::unix::raw::{uid_t, gid_t};
61+
62+
pub type dev_t = u64;
63+
pub type mode_t = u32;
64+
65+
pub type blkcnt_t = u64;
66+
pub type blksize_t = u32;
67+
pub type ino_t = u64;
68+
pub type nlink_t = u32;
69+
pub type off_t = i64;
70+
pub type time_t = i64;
71+
72+
#[repr(C)]
73+
pub struct stat {
74+
pub st_dev: dev_t,
75+
pub __pad0: [c_uchar; 4],
76+
pub __st_ino: ino_t,
77+
pub st_mode: mode_t,
78+
pub st_nlink: nlink_t,
79+
pub st_uid: uid_t,
80+
pub st_gid: gid_t,
81+
pub st_rdev: dev_t,
82+
pub __pad3: [c_uchar; 4],
83+
pub st_size: off_t,
84+
pub st_blksize: blksize_t,
85+
pub st_blocks: blkcnt_t,
86+
pub st_atime: time_t,
87+
pub st_atime_nsec: c_ulong,
88+
pub st_mtime: time_t,
89+
pub st_mtime_nsec: c_ulong,
90+
pub st_ctime: time_t,
91+
pub st_ctime_nsec: c_ulong,
92+
pub st_ino: ino_t,
93+
}
94+
4695
}

0 commit comments

Comments
 (0)