@@ -13,7 +13,9 @@ use url::Url;
13
13
14
14
const DOCS_RS_URL : & ' static str = "https://docs.rs/" ;
15
15
16
- /// Mode used for `std`.
16
+ /// Mode used for `std`. This is for unstable feature [`-Zrustdoc-map`][1].
17
+ ///
18
+ /// [1]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#rustdoc-map
17
19
#[ derive( Debug , Hash ) ]
18
20
pub enum RustdocExternMode {
19
21
/// Use a local `file://` URL.
@@ -54,11 +56,17 @@ impl<'de> serde::de::Deserialize<'de> for RustdocExternMode {
54
56
}
55
57
}
56
58
59
+ /// A map of registry names to URLs where documentations are hosted.
60
+ /// This is for unstable feature [`-Zrustdoc-map`][1].
61
+ ///
62
+ /// [1]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#rustdoc-map
57
63
#[ derive( serde:: Deserialize , Debug ) ]
58
64
#[ serde( default ) ]
59
65
pub struct RustdocExternMap {
60
66
#[ serde( deserialize_with = "default_crates_io_to_docs_rs" ) ]
61
- pub ( crate ) registries : HashMap < String , String > ,
67
+ /// * Key is the registry name in the configuration `[registries.<name>]`.
68
+ /// * Value is the URL where the documentation is hosted.
69
+ registries : HashMap < String , String > ,
62
70
std : Option < RustdocExternMode > ,
63
71
}
64
72
@@ -92,6 +100,11 @@ impl hash::Hash for RustdocExternMap {
92
100
}
93
101
}
94
102
103
+ /// Adds unstable flag [`--extern-html-root-url`][1] to the given `rustdoc`
104
+ /// invocation. This is for unstable feature [`-Zrustdoc-map`][2].
105
+ ///
106
+ /// [1]: https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#--extern-html-root-url-control-how-rustdoc-links-to-non-local-crates
107
+ /// [2]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#rustdoc-map
95
108
pub fn add_root_urls (
96
109
cx : & Context < ' _ , ' _ > ,
97
110
unit : & Unit ,
@@ -191,8 +204,11 @@ pub fn add_root_urls(
191
204
Ok ( ( ) )
192
205
}
193
206
194
- /// Indicates whether a target should have examples scraped from it
195
- /// by rustdoc. Configured within Cargo.toml.
207
+ /// Indicates whether a target should have examples scraped from it by rustdoc.
208
+ /// Configured within Cargo.toml and only for unstable feature
209
+ /// [`-Zrustdoc-scrape-examples`][1].
210
+ ///
211
+ /// [1]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#scrape-examples
196
212
#[ derive( Clone , Hash , PartialEq , Eq , PartialOrd , Ord , Debug , Copy ) ]
197
213
pub enum RustdocScrapeExamples {
198
214
Enabled ,
0 commit comments