Skip to content

Commit 397eb4f

Browse files
Add missing generation for test and proc_macro, remove old macro redirection
1 parent 65440a3 commit 397eb4f

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

src/bootstrap/bin/rustdoc.rs

+17-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ fn main() {
1616
let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set");
1717
let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
1818
let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
19+
let mut has_unstable = false;
1920

2021
use std::str::FromStr;
2122

@@ -54,9 +55,22 @@ fn main() {
5455
// it up so we can make rustdoc print this into the docs
5556
if let Some(version) = env::var_os("RUSTDOC_CRATE_VERSION") {
5657
// This "unstable-options" can be removed when `--crate-version` is stabilized
57-
cmd.arg("-Z")
58-
.arg("unstable-options")
59-
.arg("--crate-version").arg(version);
58+
if !has_unstable {
59+
cmd.arg("-Z")
60+
.arg("unstable-options");
61+
}
62+
cmd.arg("--crate-version").arg(version);
63+
has_unstable = true;
64+
}
65+
66+
// Needed to be able to run all rustdoc tests.
67+
if let Some(_) = env::var_os("RUSTDOC_GENERATE_REDIRECT_PAGES") {
68+
// This "unstable-options" can be removed when `--generate-redirect-pages` is stabilized
69+
if !has_unstable {
70+
cmd.arg("-Z")
71+
.arg("unstable-options");
72+
}
73+
cmd.arg("--generate-redirect-pages");
6074
}
6175

6276
if verbose > 1 {

src/bootstrap/doc.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,7 @@ fn invoke_rustdoc(builder: &Builder, compiler: Compiler, target: Interned<String
317317
.arg("-o").arg(&out)
318318
.arg(&path)
319319
.arg("--markdown-css")
320-
.arg("../rust.css")
321-
.arg("--generate-redirect-pages");
320+
.arg("../rust.css");
322321

323322
builder.run(&mut cmd);
324323
}
@@ -557,7 +556,9 @@ impl Step for Test {
557556
let mut cargo = builder.cargo(compiler, Mode::Test, target, "doc");
558557
compile::test_cargo(builder, &compiler, target, &mut cargo);
559558

560-
cargo.arg("--no-deps").arg("-p").arg("test");
559+
cargo.arg("--no-deps")
560+
.arg("-p").arg("test")
561+
.env("RUSTDOC_GENERATE_REDIRECT_PAGES", "1");
561562

562563
builder.run(&mut cargo);
563564
builder.cp_r(&my_out, &out);
@@ -626,9 +627,9 @@ impl Step for WhitelistedRustc {
626627
// We don't want to build docs for internal compiler dependencies in this
627628
// step (there is another step for that). Therefore, we whitelist the crates
628629
// for which docs must be built.
629-
cargo.arg("--no-deps");
630630
for krate in &["proc_macro"] {
631-
cargo.arg("-p").arg(krate);
631+
cargo.arg("-p").arg(krate)
632+
.env("RUSTDOC_GENERATE_REDIRECT_PAGES", "1");
632633
}
633634

634635
builder.run(&mut cargo);

src/librustdoc/html/render.rs

-9
Original file line numberDiff line numberDiff line change
@@ -2244,15 +2244,6 @@ impl Context {
22442244
let mut redirect_out = BufWriter::new(redirect_out);
22452245
try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst);
22462246
}
2247-
// If the item is a macro, redirect from the old macro URL (with !)
2248-
// to the new one (without).
2249-
if item_type == ItemType::Macro {
2250-
let redir_name = format!("{}.{}!.html", item_type, name);
2251-
let redir_dst = self.dst.join(redir_name);
2252-
let redirect_out = try_err!(File::create(&redir_dst), &redir_dst);
2253-
let mut redirect_out = BufWriter::new(redirect_out);
2254-
try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst);
2255-
}
22562247
}
22572248
}
22582249
}

0 commit comments

Comments
 (0)