about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2020-06-23 15:00:48 -0700
committerEric Huss <eric@huss.org>2020-06-26 07:45:28 -0700
commit6654c5852f76d6b55ebdacc0d428cad5b3dbdbed (patch)
tree329b8ba1040ebe0e0ccb40a9c2d20996c2ea255b /src
parent9672b5e95c520774cc17bffc7031c80a1bcf4b4c (diff)
downloadrust-6654c5852f76d6b55ebdacc0d428cad5b3dbdbed.tar.gz
rust-6654c5852f76d6b55ebdacc0d428cad5b3dbdbed.zip
Remove mdbook-linkcheck.
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/tool.rs19
-rw-r--r--src/ci/docker/x86_64-gnu-tools/Dockerfile3
-rw-r--r--src/tools/rustbook/Cargo.toml14
-rw-r--r--src/tools/rustbook/src/main.rs89
-rw-r--r--src/tools/tidy/src/deps.rs3
5 files changed, 2 insertions, 126 deletions
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 0055dee6092..063fb8fbb95 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -12,7 +12,7 @@ use crate::channel;
 use crate::channel::GitInfo;
 use crate::compile;
 use crate::toolstate::ToolState;
-use crate::util::{add_dylib_path, exe, CiEnv};
+use crate::util::{add_dylib_path, exe};
 use crate::Compiler;
 use crate::Mode;
 
@@ -236,7 +236,6 @@ pub fn prepare_tool_cargo(
             || path.ends_with("rls")
             || path.ends_with("clippy")
             || path.ends_with("miri")
-            || path.ends_with("rustbook")
             || path.ends_with("rustfmt")
         {
             cargo.env("LIBZ_SYS_STATIC", "1");
@@ -272,20 +271,6 @@ pub fn prepare_tool_cargo(
     cargo
 }
 
-fn rustbook_features() -> Vec<String> {
-    let mut features = Vec::new();
-
-    // Due to CI budged and risk of spurious failures we want to limit jobs running this check.
-    // At same time local builds should run it regardless of the platform.
-    // `CiEnv::None` means it's local build and `CHECK_LINKS` is defined in x86_64-gnu-tools to
-    // explicitly enable it on single job
-    if CiEnv::current() == CiEnv::None || env::var("CHECK_LINKS").is_ok() {
-        features.push("linkcheck".to_string());
-    }
-
-    features
-}
-
 macro_rules! bootstrap_tool {
     ($(
         $name:ident, $path:expr, $tool_name:expr
@@ -368,7 +353,7 @@ macro_rules! bootstrap_tool {
 }
 
 bootstrap_tool!(
-    Rustbook, "src/tools/rustbook", "rustbook", features = rustbook_features();
+    Rustbook, "src/tools/rustbook", "rustbook";
     UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen";
     Tidy, "src/tools/tidy", "tidy";
     Linkchecker, "src/tools/linkchecker", "linkchecker";
diff --git a/src/ci/docker/x86_64-gnu-tools/Dockerfile b/src/ci/docker/x86_64-gnu-tools/Dockerfile
index 148e09f6ad1..3b6e4c2cb98 100644
--- a/src/ci/docker/x86_64-gnu-tools/Dockerfile
+++ b/src/ci/docker/x86_64-gnu-tools/Dockerfile
@@ -19,9 +19,6 @@ RUN sh /scripts/sccache.sh
 
 COPY x86_64-gnu-tools/checktools.sh /tmp/
 
-# Run rustbook with `linkcheck` feature enabled
-ENV CHECK_LINKS 1
-
 ENV RUST_CONFIGURE_ARGS \
   --build=x86_64-unknown-linux-gnu \
   --save-toolstates=/tmp/toolstate/toolstates.json
diff --git a/src/tools/rustbook/Cargo.toml b/src/tools/rustbook/Cargo.toml
index ff41197faa1..bde9aca85d8 100644
--- a/src/tools/rustbook/Cargo.toml
+++ b/src/tools/rustbook/Cargo.toml
@@ -5,22 +5,8 @@ version = "0.1.0"
 license = "MIT OR Apache-2.0"
 edition = "2018"
 
-[features]
-linkcheck = ["mdbook-linkcheck", "codespan-reporting", "codespan"]
-
 [dependencies]
 clap = "2.25.0"
-failure = "0.1"
-mdbook-linkcheck = { version = "0.5.0", optional = true }
-# Keep in sync with mdbook-linkcheck.
-codespan = { version = "0.5", optional = true }
-codespan-reporting = { version = "0.5", optional = true }
-
-
-# A noop dependency that changes in the Rust repository, it's a bit of a hack.
-# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`
-# for more information.
-rustc-workspace-hack = "1.0.0"
 
 [dependencies.mdbook]
 version = "0.3.7"
diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs
index 60bd0b72910..8526568e4f9 100644
--- a/src/tools/rustbook/src/main.rs
+++ b/src/tools/rustbook/src/main.rs
@@ -30,11 +30,6 @@ fn main() {
                 .about("Tests that a book's Rust code samples compile")
                 .arg_from_usage(dir_message),
         )
-        .subcommand(
-            SubCommand::with_name("linkcheck")
-                .about("Run linkcheck with mdBook 3")
-                .arg_from_usage(dir_message),
-        )
         .get_matches();
 
     // Check which subcomamnd the user ran...
@@ -49,94 +44,10 @@ fn main() {
                 handle_error(e);
             }
         }
-        ("linkcheck", Some(sub_matches)) => {
-            #[cfg(feature = "linkcheck")]
-            {
-                let (diags, files) = linkcheck(sub_matches).expect("Error while linkchecking.");
-                if !diags.is_empty() {
-                    let color = codespan_reporting::term::termcolor::ColorChoice::Auto;
-                    let mut writer =
-                        codespan_reporting::term::termcolor::StandardStream::stderr(color);
-                    let cfg = codespan_reporting::term::Config::default();
-
-                    for diag in diags {
-                        codespan_reporting::term::emit(&mut writer, &cfg, &files, &diag)
-                            .expect("Unable to emit linkcheck error.");
-                    }
-
-                    std::process::exit(101);
-                }
-            }
-
-            #[cfg(not(feature = "linkcheck"))]
-            {
-                // This avoids the `unused_binding` lint.
-                println!(
-                    "mdbook-linkcheck is disabled, but arguments were passed: {:?}",
-                    sub_matches
-                );
-            }
-        }
         (_, _) => unreachable!(),
     };
 }
 
-#[cfg(feature = "linkcheck")]
-pub fn linkcheck(
-    args: &ArgMatches<'_>,
-) -> Result<(Vec<codespan_reporting::diagnostic::Diagnostic>, codespan::Files), failure::Error> {
-    use mdbook_linkcheck::Reason;
-
-    let book_dir = get_book_dir(args);
-    let src_dir = book_dir.join("src");
-    let book = MDBook::load(&book_dir).unwrap();
-    let linkck_cfg = mdbook_linkcheck::get_config(&book.config)?;
-    let mut files = codespan::Files::new();
-    let target_files = mdbook_linkcheck::load_files_into_memory(&book.book, &mut files);
-    let cache = mdbook_linkcheck::Cache::default();
-
-    let (links, incomplete) = mdbook_linkcheck::extract_links(target_files, &files);
-
-    let outcome =
-        mdbook_linkcheck::validate(&links, &linkck_cfg, &src_dir, &cache, &files, incomplete)?;
-
-    let mut is_real_error = false;
-
-    for link in outcome.invalid_links.iter() {
-        match &link.reason {
-            Reason::FileNotFound | Reason::TraversesParentDirectories => {
-                is_real_error = true;
-            }
-            Reason::UnsuccessfulServerResponse(status) => {
-                if status.as_u16() == 429 {
-                    eprintln!("Received 429 (TOO_MANY_REQUESTS) for link `{}`", link.link.uri);
-                } else if status.is_client_error() {
-                    is_real_error = true;
-                } else {
-                    eprintln!("Unsuccessful server response for link `{}`", link.link.uri);
-                }
-            }
-            Reason::Client(err) => {
-                if err.is_timeout() {
-                    eprintln!("Timeout for link `{}`", link.link.uri);
-                } else if err.is_server_error() {
-                    eprintln!("Server error for link `{}`", link.link.uri);
-                } else if !err.is_http() {
-                    eprintln!("Non-HTTP-related error for link: {} {}", link.link.uri, err);
-                } else {
-                    is_real_error = true;
-                }
-            }
-        }
-    }
-
-    if is_real_error {
-        Ok((outcome.generate_diagnostics(&files, linkck_cfg.warning_policy), files))
-    } else {
-        Ok((vec![], files))
-    }
-}
-
 // Build command implementation
 pub fn build(args: &ArgMatches<'_>) -> Result3<()> {
     let book_dir = get_book_dir(args);
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index 093db2a49d0..e956d0afeba 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -45,9 +45,6 @@ const EXCEPTIONS: &[(&str, &str)] = &[
     ("bitmaps", "MPL-2.0+"),                // cargo via im-rc
     // FIXME: this dependency violates the documentation comment above:
     ("fortanix-sgx-abi", "MPL-2.0"), // libstd but only for `sgx` target
-    ("dunce", "CC0-1.0"),            // mdbook-linkcheck
-    ("codespan-reporting", "Apache-2.0"), // mdbook-linkcheck
-    ("codespan", "Apache-2.0"),      // mdbook-linkcheck
     ("crossbeam-channel", "MIT/Apache-2.0 AND BSD-2-Clause"), // cargo
 ];