Skip to content

Commit df80627

Browse files
committed
Auto merge of #43872 - frewsxcv:rollup, r=frewsxcv
Rollup of 6 pull requests - Successful merges: #43756, #43790, #43846, #43848, #43862, #43868 - Failed merges:
2 parents 56fe3b2 + 1259db2 commit df80627

File tree

6 files changed

+134
-15
lines changed

6 files changed

+134
-15
lines changed

.mailmap

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ Chris Pressey <[email protected]>
5252
Chris Thorn <[email protected]> Chris Thorn <[email protected]>
5353
5454
Clinton Ryan <[email protected]>
55-
Corey Farwell <[email protected]> Corey Farwell <[email protected]>
5655
Corey Richardson <[email protected]> Elaine "See More" Nemo <[email protected]>
5756
Cyryl Płotnicki <[email protected]>
5857
Damien Schoof <[email protected]>

src/doc/rustdoc/src/passes.md

+84-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,86 @@
11
# Passes
22

3-
Coming soon!
3+
Rustdoc has a concept called "passes". These are transformations that
4+
`rustdoc` runs on your documentation before producing its final output.
5+
6+
In addition to the passes below, check out the docs for these flags:
7+
8+
* [`--passes`](command-line-arguments.html#--passes-add-more-rustdoc-passes)
9+
* [`--no-defaults`](command-line-arguments.html#--no-defaults-dont-run-default-passes)
10+
11+
## Default passes
12+
13+
By default, rustdoc will run some passes, namely:
14+
15+
* `strip-hidden`
16+
* `strip-private`
17+
* `collapse-docs`
18+
* `unindent-comments`
19+
20+
However, `strip-private` implies `strip-private-imports`, and so effectively,
21+
all passes are run by default.
22+
23+
## `strip-hidden`
24+
25+
This pass implements the `#[doc(hidden)]` attribute. When this pass runs, it
26+
checks each item, and if it is annotated with this attribute, it removes it
27+
from `rustdoc`'s output.
28+
29+
Without this pass, these items will remain in the output.
30+
31+
## `unindent-comments`
32+
33+
When you write a doc comment like this:
34+
35+
```rust,ignore
36+
/// This is a documentation comment.
37+
```
38+
39+
There's a space between the `///` and that `T`. That spacing isn't intended
40+
to be a part of the output; it's there for humans, to help separate the doc
41+
comment syntax from the text of the comment. This pass is what removes that
42+
space.
43+
44+
The exact rules are left under-specified so that we can fix issues that we find.
45+
46+
Without this pass, the exact number of spaces is preserved.
47+
48+
## `collapse-docs`
49+
50+
With this pass, multiple `#[doc]` attributes are converted into one single
51+
documentation string.
52+
53+
For example:
54+
55+
```rust,ignore
56+
#[doc = "This is the first line."]
57+
#[doc = "This is the second line."]
58+
```
59+
60+
Gets collapsed into a single doc string of
61+
62+
```text
63+
This is the first line.
64+
This is the second line.
65+
```
66+
67+
## `strip-private`
68+
69+
This removes documentation for any non-public items, so for example:
70+
71+
```rust,ignore
72+
/// These are private docs.
73+
struct Private;
74+
75+
/// These are public docs.
76+
pub struct Public;
77+
```
78+
79+
This pass removes the docs for `Private`, since they're not public.
80+
81+
This pass implies `strip-priv-imports`.
82+
83+
## `strip-priv-imports`
84+
85+
This is the same as `strip-private`, but for `extern crate` and `use`
86+
statements instead of items.

src/libcore/ops/deref.rs

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
/// # More on `Deref` coercion
2828
///
2929
/// If `T` implements `Deref<Target = U>`, and `x` is a value of type `T`, then:
30+
///
3031
/// * In immutable contexts, `*x` on non-pointer types is equivalent to
3132
/// `*Deref::deref(&x)`.
3233
/// * Values of type `&T` are coerced to values of type `&U`
@@ -113,6 +114,7 @@ impl<'a, T: ?Sized> Deref for &'a mut T {
113114
///
114115
/// If `T` implements `DerefMut<Target = U>`, and `x` is a value of type `T`,
115116
/// then:
117+
///
116118
/// * In mutable contexts, `*x` on non-pointer types is equivalent to
117119
/// `*Deref::deref(&x)`.
118120
/// * Values of type `&mut T` are coerced to values of type `&mut U`

src/librustdoc/html/static/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@
12711271
e.innerHTML = labelForToggleButton(true);
12721272
});
12731273
onEach(toggle.getElementsByClassName('toggle-label'), function(e) {
1274-
e.style.display = 'block';
1274+
e.style.display = 'inline-block';
12751275
});
12761276
}
12771277
}

src/libstd/thread/mod.rs

+45-10
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,29 @@
112112
//! will want to make use of some form of **interior mutability** through the
113113
//! [`Cell`] or [`RefCell`] types.
114114
//!
115+
//! ## Naming threads
116+
//!
117+
//! Threads are able to have associated names for identification purposes. By default, spawned
118+
//! threads are unnamed. To specify a name for a thread, build the thread with [`Builder`] and pass
119+
//! the desired thread name to [`Builder::name`]. To retrieve the thread name from within the
120+
//! thread, use [`Thread::name`]. A couple examples of where the name of a thread gets used:
121+
//!
122+
//! * If a panic occurs in a named thread, the thread name will be printed in the panic message.
123+
//! * The thread name is provided to the OS where applicable (e.g. `pthread_setname_np` in
124+
//! unix-like platforms).
125+
//!
126+
//! ## Stack size
127+
//!
128+
//! The default stack size for spawned threads is 2 MiB, though this particular stack size is
129+
//! subject to change in the future. There are two ways to manually specify the stack size for
130+
//! spawned threads:
131+
//!
132+
//! * Build the thread with [`Builder`] and pass the desired stack size to [`Builder::stack_size`].
133+
//! * Set the `RUST_MIN_STACK` environment variable to an integer representing the desired stack
134+
//! size (in bytes). Note that setting [`Builder::stack_size`] will override this.
135+
//!
136+
//! Note that the stack size of the main thread is *not* determined by Rust.
137+
//!
115138
//! [channels]: ../../std/sync/mpsc/index.html
116139
//! [`Arc`]: ../../std/sync/struct.Arc.html
117140
//! [`spawn`]: ../../std/thread/fn.spawn.html
@@ -123,11 +146,14 @@
123146
//! [`Err`]: ../../std/result/enum.Result.html#variant.Err
124147
//! [`panic!`]: ../../std/macro.panic.html
125148
//! [`Builder`]: ../../std/thread/struct.Builder.html
149+
//! [`Builder::stack_size`]: ../../std/thread/struct.Builder.html#method.stack_size
150+
//! [`Builder::name`]: ../../std/thread/struct.Builder.html#method.name
126151
//! [`thread::current`]: ../../std/thread/fn.current.html
127152
//! [`thread::Result`]: ../../std/thread/type.Result.html
128153
//! [`Thread`]: ../../std/thread/struct.Thread.html
129154
//! [`park`]: ../../std/thread/fn.park.html
130155
//! [`unpark`]: ../../std/thread/struct.Thread.html#method.unpark
156+
//! [`Thread::name`]: ../../std/thread/struct.Thread.html#method.name
131157
//! [`thread::park_timeout`]: ../../std/thread/fn.park_timeout.html
132158
//! [`Cell`]: ../cell/struct.Cell.html
133159
//! [`RefCell`]: ../cell/struct.RefCell.html
@@ -187,16 +213,8 @@ pub use self::local::{LocalKey, LocalKeyState, AccessError};
187213
///
188214
/// The two configurations available are:
189215
///
190-
/// - [`name`]: allows to give a name to the thread which is currently
191-
/// only used in `panic` messages.
192-
/// - [`stack_size`]: specifies the desired stack size. Note that this can
193-
/// be overridden by the OS.
194-
///
195-
/// If the [`stack_size`] field is not specified, the stack size
196-
/// will be the `RUST_MIN_STACK` environment variable. If it is
197-
/// not specified either, a sensible default will be set.
198-
///
199-
/// If the [`name`] field is not specified, the thread will not be named.
216+
/// - [`name`]: specifies an [associated name for the thread][naming-threads]
217+
/// - [`stack_size`]: specifies the [desired stack size for the thread][stack-size]
200218
///
201219
/// The [`spawn`] method will take ownership of the builder and create an
202220
/// [`io::Result`] to the thread handle with the given configuration.
@@ -228,6 +246,8 @@ pub use self::local::{LocalKey, LocalKeyState, AccessError};
228246
/// [`spawn`]: ../../std/thread/struct.Builder.html#method.spawn
229247
/// [`io::Result`]: ../../std/io/type.Result.html
230248
/// [`unwrap`]: ../../std/result/enum.Result.html#method.unwrap
249+
/// [naming-threads]: ./index.html#naming-threads
250+
/// [stack-size]: ./index.html#stack-size
231251
#[stable(feature = "rust1", since = "1.0.0")]
232252
#[derive(Debug)]
233253
pub struct Builder {
@@ -267,6 +287,9 @@ impl Builder {
267287
/// Names the thread-to-be. Currently the name is used for identification
268288
/// only in panic messages.
269289
///
290+
/// For more information about named threads, see
291+
/// [this module-level documentation][naming-threads].
292+
///
270293
/// # Examples
271294
///
272295
/// ```
@@ -281,6 +304,8 @@ impl Builder {
281304
///
282305
/// handler.join().unwrap();
283306
/// ```
307+
///
308+
/// [naming-threads]: ./index.html#naming-threads
284309
#[stable(feature = "rust1", since = "1.0.0")]
285310
pub fn name(mut self, name: String) -> Builder {
286311
self.name = Some(name);
@@ -292,13 +317,18 @@ impl Builder {
292317
/// The actual stack size may be greater than this value if
293318
/// the platform specifies minimal stack size.
294319
///
320+
/// For more information about the stack size for threads, see
321+
/// [this module-level documentation][stack-size].
322+
///
295323
/// # Examples
296324
///
297325
/// ```
298326
/// use std::thread;
299327
///
300328
/// let builder = thread::Builder::new().stack_size(32 * 1024);
301329
/// ```
330+
///
331+
/// [stack-size]: ./index.html#stack-size
302332
#[stable(feature = "rust1", since = "1.0.0")]
303333
pub fn stack_size(mut self, size: usize) -> Builder {
304334
self.stack_size = Some(size);
@@ -987,6 +1017,9 @@ impl Thread {
9871017

9881018
/// Gets the thread's name.
9891019
///
1020+
/// For more information about named threads, see
1021+
/// [this module-level documentation][naming-threads].
1022+
///
9901023
/// # Examples
9911024
///
9921025
/// Threads by default have no name specified:
@@ -1017,6 +1050,8 @@ impl Thread {
10171050
///
10181051
/// handler.join().unwrap();
10191052
/// ```
1053+
///
1054+
/// [naming-threads]: ./index.html#naming-threads
10201055
#[stable(feature = "rust1", since = "1.0.0")]
10211056
pub fn name(&self) -> Option<&str> {
10221057
self.cname().map(|s| unsafe { str::from_utf8_unchecked(s.to_bytes()) } )

src/libstd/time/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ pub use self::duration::Duration;
3333

3434
mod duration;
3535

36-
/// A measurement of a monotonically increasing clock.
36+
/// A measurement of a monotonically nondecreasing clock.
3737
/// Opaque and useful only with `Duration`.
3838
///
39-
/// Instants are always guaranteed to be greater than any previously measured
39+
/// Instants are always guaranteed to be no less than any previously measured
4040
/// instant when created, and are often useful for tasks such as measuring
4141
/// benchmarks or timing how long an operation takes.
4242
///

0 commit comments

Comments
 (0)