Skip to content

Commit df8551b

Browse files
committed
Update rustbook to support new test linking in reference
1 parent 87fb4ea commit df8551b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/bootstrap/src/core/build_steps/doc.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,14 @@ impl<P: Step> Step for RustbookSrc<P> {
170170
builder.add_rustc_lib_path(compiler, &mut rustbook_cmd);
171171
}
172172

173-
rustbook_cmd.arg("build").arg(&src).arg("-d").arg(&out).run(builder);
173+
rustbook_cmd
174+
.arg("build")
175+
.arg(&src)
176+
.arg("-d")
177+
.arg(&out)
178+
.arg("--rust-root")
179+
.arg(&builder.src)
180+
.run(builder);
174181

175182
for lang in &self.languages {
176183
let out = out.join(lang);

src/tools/rustbook/src/main.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ fn main() {
2222
.required(false)
2323
.value_parser(clap::value_parser!(String));
2424

25+
let root_arg = arg!(--"rust-root" <ROOT_DIR>
26+
"Path to the root of the rust source tree")
27+
.required(false)
28+
.value_parser(clap::value_parser!(PathBuf));
29+
2530
let dir_arg = arg!([dir] "Root directory for the book\n\
2631
(Defaults to the current directory when omitted)")
2732
.value_parser(clap::value_parser!(PathBuf));
@@ -37,6 +42,7 @@ fn main() {
3742
.about("Build the book from the markdown files")
3843
.arg(d_arg)
3944
.arg(l_arg)
45+
.arg(root_arg)
4046
.arg(&dir_arg),
4147
)
4248
.subcommand(
@@ -96,7 +102,8 @@ pub fn build(args: &ArgMatches) -> Result3<()> {
96102
}
97103

98104
if book.config.get_preprocessor("spec").is_some() {
99-
book.with_preprocessor(Spec::new());
105+
let rust_root = args.get_one::<PathBuf>("rust-root").cloned();
106+
book.with_preprocessor(Spec::new(rust_root)?);
100107
}
101108

102109
book.build()?;

0 commit comments

Comments
 (0)