Skip to content

Commit d5de99a

Browse files
committed
Build Rustdoc when a Doc benchmark is requested
1 parent ca003ca commit d5de99a

File tree

1 file changed

+21
-2
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+21
-2
lines changed

Diff for: src/bootstrap/src/core/build_steps/perf.rs

+21-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::fmt::{Display, Formatter};
22

33
use crate::core::build_steps::compile::{Std, Sysroot};
4-
use crate::core::build_steps::tool::RustcPerf;
4+
use crate::core::build_steps::tool::{RustcPerf, Rustdoc};
55
use crate::core::builder::Builder;
66
use crate::core::config::DebuginfoLevel;
77
use crate::utils::exec::{BootstrapCommand, command};
@@ -52,6 +52,18 @@ enum PerfCommand {
5252
},
5353
}
5454

55+
impl PerfCommand {
56+
fn shared_opts(&self) -> Option<&SharedOpts> {
57+
match self {
58+
PerfCommand::Eprintln { opts, .. }
59+
| PerfCommand::Samply { opts, .. }
60+
| PerfCommand::Cachegrind { opts, .. }
61+
| PerfCommand::Benchmark { opts, .. } => Some(opts),
62+
PerfCommand::Compare { .. } => None,
63+
}
64+
}
65+
}
66+
5567
#[derive(Debug, Clone, clap::Parser)]
5668
struct SharedOpts {
5769
/// Select the benchmarks that you want to run (separated by commas).
@@ -76,7 +88,7 @@ struct SharedOpts {
7688
profiles: Vec<Profile>,
7789
}
7890

79-
#[derive(Clone, Copy, Debug, clap::ValueEnum)]
91+
#[derive(Clone, Copy, Debug, PartialEq, clap::ValueEnum)]
8092
#[value(rename_all = "PascalCase")]
8193
pub enum Profile {
8294
Check,
@@ -140,6 +152,13 @@ Consider setting `rust.debuginfo-level = 1` in `config.toml`."#);
140152

141153
let compiler = builder.compiler(builder.top_stage, builder.config.build);
142154
builder.ensure(Std::new(compiler, builder.config.build));
155+
156+
if let Some(opts) = args.cmd.shared_opts() {
157+
if opts.profiles.contains(&Profile::Doc) {
158+
builder.ensure(Rustdoc { compiler });
159+
}
160+
}
161+
143162
let sysroot = builder.ensure(Sysroot::new(compiler));
144163
let rustc = sysroot.join("bin/rustc");
145164

0 commit comments

Comments
 (0)