You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of rust-lang#74195 - Manishearth:rollup-h3m0sl8, r=Manishearth
Rollup of 14 pull requests
Successful merges:
- rust-lang#73292 (Fixing broken link for the Eq trait)
- rust-lang#73791 (Allow for parentheses after macro intra-doc-links)
- rust-lang#74070 ( Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.)
- rust-lang#74077 (Use relative path for local links to primitives)
- rust-lang#74079 (Eliminate confusing "globals" terminology.)
- rust-lang#74107 (Hide `&mut self` methods from Deref in sidebar if there are no `DerefMut` impl for the type.)
- rust-lang#74136 (Fix broken link in rustdocdoc)
- rust-lang#74137 (Update cargo)
- rust-lang#74142 (Liballoc use vec instead of vector)
- rust-lang#74143 (Try remove unneeded ToString import in liballoc slice)
- rust-lang#74146 (update miri)
- rust-lang#74150 (Avoid "blacklist")
- rust-lang#74184 (Add docs for intra-doc-links)
- rust-lang#74188 (Tweak `::` -> `:` typo heuristic and reduce verbosity)
Failed merges:
- rust-lang#74122 (Start-up clean-up)
- rust-lang#74127 (Avoid "whitelist")
r? @ghost
For example, in the following code all of the links will link to the rustdoc page for `Bar`:
52
46
53
47
```rust
54
-
/// Does the thing.
55
-
pubfndo_the_thing(_:SomeType) {
56
-
println!("Let's do the thing!");
57
-
}
48
+
/// This struct is not [Bar]
49
+
pubstructFoo1;
50
+
51
+
/// This struct is also not [bar](Bar)
52
+
pubstructFoo2;
53
+
54
+
/// This struct is also not [bar][b]
55
+
///
56
+
/// [b]: Bar
57
+
pubstructFoo3;
58
+
59
+
/// This struct is also not [`Bar`]
60
+
pubstructFoo4;
58
61
59
-
/// Token you use to [`do_the_thing`].
60
-
pubstructSomeType;
62
+
pubstructBar;
61
63
```
62
64
63
-
The link to ``[`do_the_thing`]`` in `SomeType`'s docs will properly link to the page for `fn
64
-
do_the_thing`. Note that here, rustdoc will insert the link target for you, but manually writing the
65
-
target out also works:
65
+
You can refer to anything in scope, and use paths, including `Self`. You may also use `foo()` and `foo!()` to refer to methods/functions and macros respectively.
66
66
67
-
```rust
68
-
pubmodsome_module {
69
-
/// Token you use to do the thing.
70
-
pubstructSomeStruct;
71
-
}
67
+
```rust,edition2018
68
+
use std::sync::mpsc::Receiver;
72
69
73
-
///Does the thing. Requires one [`SomeStruct`] for the thing to work.
70
+
/// This is an version of [`Receiver`], with support for [`std::future`].
74
71
///
75
-
/// [`SomeStruct`]: some_module::SomeStruct
76
-
pubfndo_the_thing(_:some_module::SomeStruct) {
77
-
println!("Let's do the thing!");
72
+
/// You can obtain a [`std::future::Future`] by calling [`Self::recv()`].
73
+
pub struct AsyncReceiver<T> {
74
+
sender: Receiver<T>
75
+
}
76
+
77
+
impl<T> AsyncReceiver<T> {
78
+
pub async fn recv() -> T {
79
+
unimplemented!()
80
+
}
78
81
}
79
82
```
80
83
81
-
For more details, check out [the RFC][RFC 1946], and see [the tracking issue][43466] for more
82
-
information about what parts of the feature are available.
84
+
Paths in Rust have three namespaces: type, value, and macro. Items from these namespaces are allowed to overlap. In case of ambiguity, rustdoc will warn about the ambiguity and ask you to disambiguate, which can be done by using a prefix like `struct@`, `enum@`, `type@`, `trait@`, `union@`, `const@`, `static@`, `value@`, `function@`, `mod@`, `fn@`, `module@`, `method@` , `macro@`, or `derive@`:
Note: Because of how `macro_rules` macros are scoped in Rust, the intra-doc links of a `macro_rules` macro will be resolved relative to the crate root, as opposed to the module it is defined in.
85
97
86
98
## Extensions to the `#[doc]` attribute
87
99
@@ -321,7 +333,7 @@ library, as an equivalent command-line argument is provided to `rustc` when buil
321
333
### `--index-page`: provide a top-level landing page for docs
322
334
323
335
This feature allows you to generate an index-page with a given markdown file. A good example of it
324
-
is the [rust documentation index](https://doc.rust-lang.org/index.html).
336
+
is the [rust documentation index](https://doc.rust-lang.org/nightly/index.html).
325
337
326
338
With this, you'll have a page which you can custom as much as you want at the top of your crates.
0 commit comments