1
Fork 0

Rollup merge of #81223 - GuillaumeGomez:generate-redirect-map, r=jyn514

[rustdoc] Generate redirect map file

Fixes #81134.

So with this code:

```rust
#![crate_name = "foo"]

pub use private::Quz;
pub use hidden::Bar;

mod private {
    pub struct Quz;
}

#[doc(hidden)]
pub mod hidden {
    pub struct Bar;
}

#[macro_export]
macro_rules! foo {
() => {}
}
```

It generates:

```json
{
  "foo/macro.foo!.html": "foo/macro.foo.html",
  "foo/private/struct.Quz.html": "foo/struct.Quz.html",
  "foo/hidden/struct.Bar.html": "foo/struct.Bar.html"
}
```

Do the pathes look as you expected ````@pietroalbini?````

r? ````@jyn514````
This commit is contained in:
Yuki Okushi 2021-03-03 16:27:38 +09:00 committed by GitHub
commit 9a827d9f7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 150 additions and 10 deletions

View file

@ -263,6 +263,8 @@ crate struct RenderOptions {
crate document_private: bool,
/// Document items that have `doc(hidden)`.
crate document_hidden: bool,
/// If `true`, generate a JSON file in the crate folder instead of HTML redirection files.
crate generate_redirect_map: bool,
crate unstable_features: rustc_feature::UnstableFeatures,
}
@ -570,6 +572,7 @@ impl Options {
let document_private = matches.opt_present("document-private-items");
let document_hidden = matches.opt_present("document-hidden-items");
let run_check = matches.opt_present("check");
let generate_redirect_map = matches.opt_present("generate-redirect-map");
let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
@ -627,6 +630,7 @@ impl Options {
generate_search_filter,
document_private,
document_hidden,
generate_redirect_map,
unstable_features: rustc_feature::UnstableFeatures::from_environment(
crate_name.as_deref(),
),