diff options
| author | Eric Huss <eric@huss.org> | 2024-10-23 10:52:12 -0700 |
|---|---|---|
| committer | Eric Huss <eric@huss.org> | 2024-10-23 11:44:23 -0700 |
| commit | df8551b60aa2b3442ccda21ac5a8bcabd2a7d67c (patch) | |
| tree | 8d1ff259d9058857d6d10921a8245db56bd744e3 | |
| parent | 87fb4eaa9d892d3331c2651736d6d141ea827b90 (diff) | |
| download | rust-df8551b60aa2b3442ccda21ac5a8bcabd2a7d67c.tar.gz rust-df8551b60aa2b3442ccda21ac5a8bcabd2a7d67c.zip | |
Update rustbook to support new test linking in reference
| -rw-r--r-- | src/bootstrap/src/core/build_steps/doc.rs | 9 | ||||
| -rw-r--r-- | src/tools/rustbook/src/main.rs | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs index ca2b8742647..69ec832a44a 100644 --- a/src/bootstrap/src/core/build_steps/doc.rs +++ b/src/bootstrap/src/core/build_steps/doc.rs @@ -170,7 +170,14 @@ impl<P: Step> Step for RustbookSrc<P> { builder.add_rustc_lib_path(compiler, &mut rustbook_cmd); } - rustbook_cmd.arg("build").arg(&src).arg("-d").arg(&out).run(builder); + rustbook_cmd + .arg("build") + .arg(&src) + .arg("-d") + .arg(&out) + .arg("--rust-root") + .arg(&builder.src) + .run(builder); for lang in &self.languages { let out = out.join(lang); diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs index 2118af61396..f905b9277ff 100644 --- a/src/tools/rustbook/src/main.rs +++ b/src/tools/rustbook/src/main.rs @@ -22,6 +22,11 @@ fn main() { .required(false) .value_parser(clap::value_parser!(String)); + let root_arg = arg!(--"rust-root" <ROOT_DIR> +"Path to the root of the rust source tree") + .required(false) + .value_parser(clap::value_parser!(PathBuf)); + let dir_arg = arg!([dir] "Root directory for the book\n\ (Defaults to the current directory when omitted)") .value_parser(clap::value_parser!(PathBuf)); @@ -37,6 +42,7 @@ fn main() { .about("Build the book from the markdown files") .arg(d_arg) .arg(l_arg) + .arg(root_arg) .arg(&dir_arg), ) .subcommand( @@ -96,7 +102,8 @@ pub fn build(args: &ArgMatches) -> Result3<()> { } if book.config.get_preprocessor("spec").is_some() { - book.with_preprocessor(Spec::new()); + let rust_root = args.get_one::<PathBuf>("rust-root").cloned(); + book.with_preprocessor(Spec::new(rust_root)?); } book.build()?; |
