Skip to content

Commit 5c674a1

Browse files
authored
Auto merge of #34695 - steveklabnik:rollup, r=steveklabnik
Rollup of 15 pull requests - Successful merges: #33250, #33265, #34277, #34327, #34521, #34558, #34615, #34619, #34621, #34625, #34626, #34636, #34664, #34667, #34685 - Failed merges: #33951
2 parents 801d268 + 2262d73 commit 5c674a1

File tree

23 files changed

+183
-131
lines changed

23 files changed

+183
-131
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ build.
6666
6767
[MSYS2][msys2] can be used to easily build Rust on Windows:
6868
69-
msys2: https://msys2.github.io/
69+
[msys2]: https://msys2.github.io/
7070
7171
1. Grab the latest [MSYS2 installer][msys2] and go through the installer.
7272

mk/main.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
######################################################################
1414

1515
# The version number
16-
CFG_RELEASE_NUM=1.11.0
16+
CFG_RELEASE_NUM=1.12.0
1717

1818
# An optional number to put after the label, e.g. '.2' -> '-beta.2'
1919
# NB Make sure it starts with a dot to conform to semver pre-release

src/bootstrap/bootstrap.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def main():
359359
parser.add_argument('--clean', action='store_true')
360360
parser.add_argument('-v', '--verbose', action='store_true')
361361

362-
args = [a for a in sys.argv if a != '-h']
362+
args = [a for a in sys.argv if a != '-h' and a != '--help']
363363
args, _ = parser.parse_known_args(args)
364364

365365
# Configure initial bootstrap

src/doc/book/closures.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ fn call_with_ref<'a, F>(some_closure:F) -> i32
339339
where F: Fn(&'a 32) -> i32 {
340340
```
341341

342-
However this presents a problem with in our case. When you specify the explict
342+
However this presents a problem with in our case. When you specify the explicit
343343
lifetime on a function it binds that lifetime to the *entire* scope of the function
344344
instead of just the invocation scope of our closure. This means that the borrow checker
345345
will see a mutable reference in the same lifetime as our immutable reference and fail
@@ -354,7 +354,7 @@ fn call_with_ref<F>(some_closure:F) -> i32
354354
```
355355

356356
This lets the Rust compiler find the minimum lifetime to invoke our closure and
357-
satisfy the borrow checker's rules. Our function then compiles and excutes as we
357+
satisfy the borrow checker's rules. Our function then compiles and executes as we
358358
expect.
359359

360360
```rust

src/doc/book/documentation.md

+11
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,17 @@ you have a module in `foo.rs`, you'll often open its code and see this:
486486
//! The `foo` module contains a lot of useful functionality blah blah blah
487487
```
488488

489+
### Crate documentation
490+
491+
Crates can be documented by placing an inner doc comment (`//!`) at the
492+
beginning of the crate root, aka `lib.rs`:
493+
494+
```rust
495+
//! This is documentation for the `foo` crate.
496+
//!
497+
//! The foo crate is meant to be used for bar.
498+
```
499+
489500
### Documentation comment style
490501

491502
Check out [RFC 505][rfc505] for full conventions around the style and format of

src/doc/book/guessing-game.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ We could also use a range of versions.
370370
[Cargo’s documentation][cargodoc] contains more details.
371371

372372
[semver]: http://semver.org
373-
[cargodoc]: http://doc.crates.io/crates-io.html
373+
[cargodoc]: http://doc.crates.io/specifying-dependencies.html
374374

375375
Now, without changing any of our code, let’s build our project:
376376

src/doc/book/loops.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ When you need to keep track of how many times you already looped, you can use th
105105
#### On ranges:
106106

107107
```rust
108-
for (i,j) in (5..10).enumerate() {
108+
for (i, j) in (5..10).enumerate() {
109109
println!("i = {} and j = {}", i, j);
110110
}
111111
```

src/doc/book/mutability.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ Note that here, the `x` is mutable, but not the `y`.
6262
# Interior vs. Exterior Mutability
6363

6464
However, when we say something is ‘immutable’ in Rust, that doesn’t mean that
65-
it’s not able to be changed: we mean something has ‘exterior mutability’. Consider,
66-
for example, [`Arc<T>`][arc]:
65+
it’s not able to be changed: we are referring to its ‘exterior mutability’ that
66+
in this case is immutable. Consider, for example, [`Arc<T>`][arc]:
6767

6868
```rust
6969
use std::sync::Arc;

src/doc/book/structs.md

+50-23
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,51 @@ struct Point(i32, i32, i32);
163163
let black = Color(0, 0, 0);
164164
let origin = Point(0, 0, 0);
165165
```
166-
Here, `black` and `origin` are not equal, even though they contain the same
167-
values.
168166

169-
It is almost always better to use a `struct` than a tuple struct. We
170-
would write `Color` and `Point` like this instead:
167+
Here, `black` and `origin` are not the same type, even though they contain the
168+
same values.
169+
170+
The members of a tuple struct may be accessed by dot notation or destructuring
171+
`let`, just like regular tuples:
172+
173+
```rust
174+
# struct Color(i32, i32, i32);
175+
# struct Point(i32, i32, i32);
176+
# let black = Color(0, 0, 0);
177+
# let origin = Point(0, 0, 0);
178+
let black_r = black.0;
179+
let Point(_, origin_y, origin_z) = origin;
180+
```
181+
182+
Patterns like `Point(_, origin_y, origin_z)` are also used in
183+
[match expressions][match].
184+
185+
One case when a tuple struct is very useful is when it has only one element.
186+
We call this the ‘newtype’ pattern, because it allows you to create a new type
187+
that is distinct from its contained value and also expresses its own semantic
188+
meaning:
189+
190+
```rust
191+
struct Inches(i32);
192+
193+
let length = Inches(10);
194+
195+
let Inches(integer_length) = length;
196+
println!("length is {} inches", integer_length);
197+
```
198+
199+
As above, you can extract the inner integer type through a destructuring `let`.
200+
In this case, the `let Inches(integer_length)` assigns `10` to `integer_length`.
201+
We could have used dot notation to do the same thing:
202+
203+
```rust
204+
# struct Inches(i32);
205+
# let length = Inches(10);
206+
let integer_length = length.0;
207+
```
208+
209+
It's always possible to use a `struct` instead of a tuple struct, and can be
210+
clearer. We could write `Color` and `Point` like this instead:
171211

172212
```rust
173213
struct Color {
@@ -187,32 +227,19 @@ Good names are important, and while values in a tuple struct can be
187227
referenced with dot notation as well, a `struct` gives us actual names,
188228
rather than positions.
189229

190-
There _is_ one case when a tuple struct is very useful, though, and that is when
191-
it has only one element. We call this the ‘newtype’ pattern, because
192-
it allows you to create a new type that is distinct from its contained value
193-
and also expresses its own semantic meaning:
194-
195-
```rust
196-
struct Inches(i32);
197-
198-
let length = Inches(10);
199-
200-
let Inches(integer_length) = length;
201-
println!("length is {} inches", integer_length);
202-
```
203-
204-
As you can see here, you can extract the inner integer type through a
205-
destructuring `let`, as with regular tuples. In this case, the
206-
`let Inches(integer_length)` assigns `10` to `integer_length`.
230+
[match]: match.html
207231

208232
# Unit-like structs
209233

210234
You can define a `struct` with no members at all:
211235

212236
```rust
213-
struct Electron;
237+
struct Electron {} // use empty braces...
238+
struct Proton; // ...or just a semicolon
214239

215-
let x = Electron;
240+
// whether you declared the struct with braces or not, do the same when creating one
241+
let x = Electron {};
242+
let y = Proton;
216243
```
217244

218245
Such a `struct` is called ‘unit-like’ because it resembles the empty

src/doc/book/testing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ one.
431431

432432
Cargo will ignore files in subdirectories of the `tests/` directory.
433433
Therefore shared modules in integrations tests are possible.
434-
For example `tests/common/mod.rs` is not seperatly compiled by cargo but can
434+
For example `tests/common/mod.rs` is not separately compiled by cargo but can
435435
be imported in every test with `mod common;`
436436

437437
That's all there is to the `tests` directory. The `tests` module isn't needed

src/libcore/iter/mod.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -1198,17 +1198,15 @@ impl<I: ExactSizeIterator> ExactSizeIterator for Peekable<I> {}
11981198
impl<I: Iterator> Peekable<I> {
11991199
/// Returns a reference to the next() value without advancing the iterator.
12001200
///
1201-
/// The `peek()` method will return the value that a call to [`next()`] would
1202-
/// return, but does not advance the iterator. Like [`next()`], if there is
1203-
/// a value, it's wrapped in a `Some(T)`, but if the iterator is over, it
1204-
/// will return `None`.
1201+
/// Like [`next()`], if there is a value, it is wrapped in a `Some(T)`.
1202+
/// But if the iteration is over, `None` is returned.
12051203
///
12061204
/// [`next()`]: trait.Iterator.html#tymethod.next
12071205
///
1208-
/// Because `peek()` returns reference, and many iterators iterate over
1209-
/// references, this leads to a possibly confusing situation where the
1206+
/// Because `peek()` returns a reference, and many iterators iterate over
1207+
/// references, there can be a possibly confusing situation where the
12101208
/// return value is a double reference. You can see this effect in the
1211-
/// examples below, with `&&i32`.
1209+
/// examples below.
12121210
///
12131211
/// # Examples
12141212
///
@@ -1225,13 +1223,13 @@ impl<I: Iterator> Peekable<I> {
12251223
///
12261224
/// assert_eq!(iter.next(), Some(&2));
12271225
///
1228-
/// // we can peek() multiple times, the iterator won't advance
1226+
/// // The iterator does not advance even if we `peek` multiple times
12291227
/// assert_eq!(iter.peek(), Some(&&3));
12301228
/// assert_eq!(iter.peek(), Some(&&3));
12311229
///
12321230
/// assert_eq!(iter.next(), Some(&3));
12331231
///
1234-
/// // after the iterator is finished, so is peek()
1232+
/// // After the iterator is finished, so is `peek()`
12351233
/// assert_eq!(iter.peek(), None);
12361234
/// assert_eq!(iter.next(), None);
12371235
/// ```
@@ -1263,10 +1261,10 @@ impl<I: Iterator> Peekable<I> {
12631261
///
12641262
/// let mut iter = xs.iter().peekable();
12651263
///
1266-
/// // there are still elements to iterate over
1264+
/// // There are still elements to iterate over
12671265
/// assert_eq!(iter.is_empty(), false);
12681266
///
1269-
/// // let's consume the iterator
1267+
/// // Let's consume the iterator
12701268
/// iter.next();
12711269
/// iter.next();
12721270
/// iter.next();

src/libcore/num/f32.rs

+30-30
Original file line numberDiff line numberDiff line change
@@ -20,121 +20,121 @@ use mem;
2020
use num::Float;
2121
use num::FpCategory as Fp;
2222

23+
/// The radix or base of the internal representation of `f32`.
2324
#[stable(feature = "rust1", since = "1.0.0")]
24-
#[allow(missing_docs)]
2525
pub const RADIX: u32 = 2;
2626

27+
/// Number of significant digits in base 2.
2728
#[stable(feature = "rust1", since = "1.0.0")]
28-
#[allow(missing_docs)]
2929
pub const MANTISSA_DIGITS: u32 = 24;
30+
/// Approximate number of significant digits in base 10.
3031
#[stable(feature = "rust1", since = "1.0.0")]
31-
#[allow(missing_docs)]
3232
pub const DIGITS: u32 = 6;
3333

34+
/// Difference between `1.0` and the next largest representable number.
3435
#[stable(feature = "rust1", since = "1.0.0")]
35-
#[allow(missing_docs)]
3636
pub const EPSILON: f32 = 1.19209290e-07_f32;
3737

38-
/// Smallest finite f32 value
38+
/// Smallest finite `f32` value.
3939
#[stable(feature = "rust1", since = "1.0.0")]
4040
pub const MIN: f32 = -3.40282347e+38_f32;
41-
/// Smallest positive, normalized f32 value
41+
/// Smallest positive normal `f32` value.
4242
#[stable(feature = "rust1", since = "1.0.0")]
4343
pub const MIN_POSITIVE: f32 = 1.17549435e-38_f32;
44-
/// Largest finite f32 value
44+
/// Largest finite `f32` value.
4545
#[stable(feature = "rust1", since = "1.0.0")]
4646
pub const MAX: f32 = 3.40282347e+38_f32;
4747

48+
/// One greater than the minimum possible normal power of 2 exponent.
4849
#[stable(feature = "rust1", since = "1.0.0")]
49-
#[allow(missing_docs)]
5050
pub const MIN_EXP: i32 = -125;
51+
/// Maximum possible power of 2 exponent.
5152
#[stable(feature = "rust1", since = "1.0.0")]
52-
#[allow(missing_docs)]
5353
pub const MAX_EXP: i32 = 128;
5454

55+
/// Minimum possible normal power of 10 exponent.
5556
#[stable(feature = "rust1", since = "1.0.0")]
56-
#[allow(missing_docs)]
5757
pub const MIN_10_EXP: i32 = -37;
58+
/// Maximum possible power of 10 exponent.
5859
#[stable(feature = "rust1", since = "1.0.0")]
59-
#[allow(missing_docs)]
6060
pub const MAX_10_EXP: i32 = 38;
6161

62+
/// Not a Number (NaN).
6263
#[stable(feature = "rust1", since = "1.0.0")]
63-
#[allow(missing_docs)]
6464
pub const NAN: f32 = 0.0_f32/0.0_f32;
65+
/// Infinity (∞).
6566
#[stable(feature = "rust1", since = "1.0.0")]
66-
#[allow(missing_docs)]
6767
pub const INFINITY: f32 = 1.0_f32/0.0_f32;
68+
/// Negative infinity (-∞).
6869
#[stable(feature = "rust1", since = "1.0.0")]
69-
#[allow(missing_docs)]
7070
pub const NEG_INFINITY: f32 = -1.0_f32/0.0_f32;
7171

7272
/// Basic mathematical constants.
7373
#[stable(feature = "rust1", since = "1.0.0")]
7474
pub mod consts {
7575
// FIXME: replace with mathematical constants from cmath.
7676

77-
/// Archimedes' constant
77+
/// Archimedes' constant (π)
7878
#[stable(feature = "rust1", since = "1.0.0")]
7979
pub const PI: f32 = 3.14159265358979323846264338327950288_f32;
8080

81-
/// pi/2.0
81+
/// π/2
8282
#[stable(feature = "rust1", since = "1.0.0")]
8383
pub const FRAC_PI_2: f32 = 1.57079632679489661923132169163975144_f32;
8484

85-
/// pi/3.0
85+
/// π/3
8686
#[stable(feature = "rust1", since = "1.0.0")]
8787
pub const FRAC_PI_3: f32 = 1.04719755119659774615421446109316763_f32;
8888

89-
/// pi/4.0
89+
/// π/4
9090
#[stable(feature = "rust1", since = "1.0.0")]
9191
pub const FRAC_PI_4: f32 = 0.785398163397448309615660845819875721_f32;
9292

93-
/// pi/6.0
93+
/// π/6
9494
#[stable(feature = "rust1", since = "1.0.0")]
9595
pub const FRAC_PI_6: f32 = 0.52359877559829887307710723054658381_f32;
9696

97-
/// pi/8.0
97+
/// π/8
9898
#[stable(feature = "rust1", since = "1.0.0")]
9999
pub const FRAC_PI_8: f32 = 0.39269908169872415480783042290993786_f32;
100100

101-
/// 1.0/pi
101+
/// 1
102102
#[stable(feature = "rust1", since = "1.0.0")]
103103
pub const FRAC_1_PI: f32 = 0.318309886183790671537767526745028724_f32;
104104

105-
/// 2.0/pi
105+
/// 2
106106
#[stable(feature = "rust1", since = "1.0.0")]
107107
pub const FRAC_2_PI: f32 = 0.636619772367581343075535053490057448_f32;
108108

109-
/// 2.0/sqrt(pi)
109+
/// 2/sqrt(π)
110110
#[stable(feature = "rust1", since = "1.0.0")]
111111
pub const FRAC_2_SQRT_PI: f32 = 1.12837916709551257389615890312154517_f32;
112112

113-
/// sqrt(2.0)
113+
/// sqrt(2)
114114
#[stable(feature = "rust1", since = "1.0.0")]
115115
pub const SQRT_2: f32 = 1.41421356237309504880168872420969808_f32;
116116

117-
/// 1.0/sqrt(2.0)
117+
/// 1/sqrt(2)
118118
#[stable(feature = "rust1", since = "1.0.0")]
119119
pub const FRAC_1_SQRT_2: f32 = 0.707106781186547524400844362104849039_f32;
120120

121-
/// Euler's number
121+
/// Euler's number (e)
122122
#[stable(feature = "rust1", since = "1.0.0")]
123123
pub const E: f32 = 2.71828182845904523536028747135266250_f32;
124124

125-
/// log2(e)
125+
/// log<sub>2</sub>(e)
126126
#[stable(feature = "rust1", since = "1.0.0")]
127127
pub const LOG2_E: f32 = 1.44269504088896340735992468100189214_f32;
128128

129-
/// log10(e)
129+
/// log<sub>10</sub>(e)
130130
#[stable(feature = "rust1", since = "1.0.0")]
131131
pub const LOG10_E: f32 = 0.434294481903251827651128918916605082_f32;
132132

133-
/// ln(2.0)
133+
/// ln(2)
134134
#[stable(feature = "rust1", since = "1.0.0")]
135135
pub const LN_2: f32 = 0.693147180559945309417232121458176568_f32;
136136

137-
/// ln(10.0)
137+
/// ln(10)
138138
#[stable(feature = "rust1", since = "1.0.0")]
139139
pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32;
140140
}

0 commit comments

Comments
 (0)