diff --git a/src/Cargo.lock b/src/Cargo.lock index d91a165e537..73a2630911f 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -1706,7 +1706,7 @@ dependencies = [ "rls-rustc 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rls-vfs 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustfmt-nightly 0.8.2 (git+https://github.com/rust-lang-nursery/rustfmt?rev=5e5992517d3591e2708d4ca6b155dfcbdf3344b9)", + "rustfmt-nightly 0.8.2", "serde 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2367,31 +2367,6 @@ dependencies = [ "serde_json 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rustfmt-nightly" -version = "0.8.2" -source = "git+https://github.com/rust-lang-nursery/rustfmt?rev=5e5992517d3591e2708d4ca6b155dfcbdf3344b9#5e5992517d3591e2708d4ca6b155dfcbdf3344b9" -dependencies = [ - "cargo_metadata 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", - "derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "isatty 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_target 182.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax 182.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rustfmt-nightly" version = "0.8.2" @@ -3239,7 +3214,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a54aa04a10c68c1c4eacb4337fd883b435997ede17a9385784b990777686b09a" "checksum rustfix 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9da3cf9b79dc889a2c9879643f26d7a53e37e9361c7566b7d2787d5ace0d8396" -"checksum rustfmt-nightly 0.8.2 (git+https://github.com/rust-lang-nursery/rustfmt?rev=5e5992517d3591e2708d4ca6b155dfcbdf3344b9)" = "" "checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637" "checksum schannel 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "dc1fabf2a7b6483a141426e1afd09ad543520a77ac49bd03c286e7696ccfd77f" "checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" diff --git a/src/Cargo.toml b/src/Cargo.toml index 8ce4c97601b..135bed6200b 100644 --- a/src/Cargo.toml +++ b/src/Cargo.toml @@ -64,10 +64,11 @@ debug-assertions = false [patch."https://github.com/rust-lang/cargo"] cargo = { path = "tools/cargo" } -[patch.crates-io] +[patch."https://github.com/rust-lang-nursery/rustfmt"] # Similar to Cargo above we want the RLS to use a vendored version of `rustfmt` # that we're shipping as well (to ensure that the rustfmt in RLS and the -# `rustfmt` executable are the same exact vesion). Unlike Cargo, however, the -# RLS depends on `rustfmt` from crates.io, so we put this in a `[patch]` section -# for crates.io +# `rustfmt` executable are the same exact version). rustfmt-nightly = { path = "tools/rustfmt" } + +[patch."https://github.com/rust-lang-nursery/rust-clippy"] +clippy = { path = "tools/clippy" } diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index e4fbabdf231..ca804abd26a 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1229,7 +1229,7 @@ impl Step for Clippy { let tmp = tmpdir(builder); let image = tmp.join("clippy-image"); drop(fs::remove_dir_all(&image)); - t!(fs::create_dir_all(&image)); + builder.create_dir(&image); // Prepare the image directory // We expect clippy to build, because we've exited this step above if tool @@ -1238,8 +1238,13 @@ impl Step for Clippy { compiler: builder.compiler(stage, builder.config.build), target, extra_features: Vec::new() }).or_else(|| { println!("Unable to build clippy, skipping dist"); None })?; + let cargoclippy = builder.ensure(tool::CargoClippy { + compiler: builder.compiler(stage, builder.config.build), + target, extra_features: Vec::new() + }).or_else(|| { println!("Unable to build cargo clippy, skipping dist"); None })?; builder.install(&clippy, &image.join("bin"), 0o755); + builder.install(&cargoclippy, &image.join("bin"), 0o755); let doc = image.join("share/doc/clippy"); builder.install(&src.join("README.md"), &doc, 0o644); builder.install(&src.join("LICENSE"), &doc, 0o644); diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index b3d7b9a91ec..42c65b750d3 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -584,6 +584,14 @@ macro_rules! tool_extended { tool_extended!((self, builder), Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", {}; + CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", { + // Clippy depends on procedural macros (serde), which requires a full host + // compiler to be available, so we need to depend on that. + builder.ensure(compile::Rustc { + compiler: self.compiler, + target: builder.config.build, + }); + }; Clippy, clippy, "src/tools/clippy", "clippy-driver", { // Clippy depends on procedural macros (serde), which requires a full host // compiler to be available, so we need to depend on that. @@ -594,6 +602,14 @@ tool_extended!((self, builder), }; Miri, miri, "src/tools/miri", "miri", {}; Rls, rls, "src/tools/rls", "rls", { + let clippy = builder.ensure(Clippy { + compiler: self.compiler, + target: self.target, + extra_features: Vec::new(), + }); + if clippy.is_some() { + self.extra_features.push("clippy".to_owned()); + } builder.ensure(native::Openssl { target: self.target, });