about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-01-23 17:03:32 +0800
committerGitHub <noreply@github.com>2018-01-23 17:03:32 +0800
commit116fb72d3db430c431ffbc9f9e8981529eea804b (patch)
tree60524797b540f4fa5be33d3ed012c3755b430294 /src/tools
parent47a8eb7c4e24b61a8a9ab4eaff60ef65291aaa56 (diff)
parent38ddb446b9da85532fc4a1540eff45509b0b9289 (diff)
Rollup merge of #47423 - est31:rustbook_checking, r=alexcrichton
Check for deadlinks from the summary during book generation

Previously, any deadlinks from a book's SUMMARY.md wouldn't
cause any errors or warnings or similar but mdbook would simply
create a page with blank content.

This has kept bug #47394 hidden. It should have been detected
back in the PR when those wrongly named files got added to the
book.

PR #47414 was one component of the solution. This change
is a second line of defense for the unstable book and a first
line of defense for any other book.

We also update mdbook to the most recent version.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/rustbook/Cargo.toml2
-rw-r--r--src/tools/rustbook/src/main.rs12
2 files changed, 8 insertions, 6 deletions
diff --git a/src/tools/rustbook/Cargo.toml b/src/tools/rustbook/Cargo.toml
index 4aa096246bc..bc35cbe9fbb 100644
--- a/src/tools/rustbook/Cargo.toml
+++ b/src/tools/rustbook/Cargo.toml
@@ -8,5 +8,5 @@ license = "MIT/Apache-2.0"
 clap = "2.25.0"
 
 [dependencies.mdbook]
-version = "0.0.26"
+version = "0.0.28"
 default-features = false
diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs
index a0c3e811a7a..50f4364e448 100644
--- a/src/tools/rustbook/src/main.rs
+++ b/src/tools/rustbook/src/main.rs
@@ -52,12 +52,14 @@ fn main() {
 // Build command implementation
 pub fn build(args: &ArgMatches) -> Result<()> {
     let book_dir = get_book_dir(args);
-    let book = MDBook::new(&book_dir).read_config()?;
+    let mut book = MDBook::new(&book_dir).read_config()?;
 
-    let mut book = match args.value_of("dest-dir") {
-        Some(dest_dir) => book.with_destination(dest_dir),
-        None => book,
-    };
+    // Set this to allow us to catch bugs in advance.
+    book.config.build.create_missing = false;
+
+    if let Some(dest_dir) = args.value_of("dest-dir") {
+        book.config.build.build_dir = PathBuf::from(dest_dir);
+    }
 
     book.build()?;