Skip to content

Commit 4ba5ff4

Browse files
committed
Auto merge of #52172 - oli-obk:clippy_in_rls, r=nrc
Inject clippy into the rls again Also makes sure we actually point to the local rustfmt r? @nrc cc @Manishearth
2 parents 704af2d + 0fc61be commit 4ba5ff4

File tree

4 files changed

+28
-32
lines changed

4 files changed

+28
-32
lines changed

src/Cargo.lock

+1-27
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,7 @@ dependencies = [
17061706
"rls-rustc 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
17071707
"rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
17081708
"rls-vfs 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
1709-
"rustfmt-nightly 0.8.2 (git+https://github.com/rust-lang-nursery/rustfmt?rev=5e5992517d3591e2708d4ca6b155dfcbdf3344b9)",
1709+
"rustfmt-nightly 0.8.2",
17101710
"serde 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
17111711
"serde_derive 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
17121712
"serde_json 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2367,31 +2367,6 @@ dependencies = [
23672367
"serde_json 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
23682368
]
23692369

2370-
[[package]]
2371-
name = "rustfmt-nightly"
2372-
version = "0.8.2"
2373-
source = "git+https://github.com/rust-lang-nursery/rustfmt?rev=5e5992517d3591e2708d4ca6b155dfcbdf3344b9#5e5992517d3591e2708d4ca6b155dfcbdf3344b9"
2374-
dependencies = [
2375-
"cargo_metadata 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
2376-
"derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
2377-
"diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
2378-
"env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
2379-
"failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
2380-
"getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
2381-
"isatty 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
2382-
"itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
2383-
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
2384-
"regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
2385-
"rustc-ap-rustc_target 182.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
2386-
"rustc-ap-syntax 182.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
2387-
"serde 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
2388-
"serde_derive 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
2389-
"serde_json 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
2390-
"term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
2391-
"toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
2392-
"unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
2393-
]
2394-
23952370
[[package]]
23962371
name = "rustfmt-nightly"
23972372
version = "0.8.2"
@@ -3239,7 +3214,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
32393214
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
32403215
"checksum rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a54aa04a10c68c1c4eacb4337fd883b435997ede17a9385784b990777686b09a"
32413216
"checksum rustfix 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9da3cf9b79dc889a2c9879643f26d7a53e37e9361c7566b7d2787d5ace0d8396"
3242-
"checksum rustfmt-nightly 0.8.2 (git+https://github.com/rust-lang-nursery/rustfmt?rev=5e5992517d3591e2708d4ca6b155dfcbdf3344b9)" = "<none>"
32433217
"checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637"
32443218
"checksum schannel 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "dc1fabf2a7b6483a141426e1afd09ad543520a77ac49bd03c286e7696ccfd77f"
32453219
"checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28"

src/Cargo.toml

+5-4
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ debug-assertions = false
6464
[patch."https://github.com/rust-lang/cargo"]
6565
cargo = { path = "tools/cargo" }
6666

67-
[patch.crates-io]
67+
[patch."https://github.com/rust-lang-nursery/rustfmt"]
6868
# Similar to Cargo above we want the RLS to use a vendored version of `rustfmt`
6969
# that we're shipping as well (to ensure that the rustfmt in RLS and the
70-
# `rustfmt` executable are the same exact vesion). Unlike Cargo, however, the
71-
# RLS depends on `rustfmt` from crates.io, so we put this in a `[patch]` section
72-
# for crates.io
70+
# `rustfmt` executable are the same exact version).
7371
rustfmt-nightly = { path = "tools/rustfmt" }
72+
73+
[patch."https://github.com/rust-lang-nursery/rust-clippy"]
74+
clippy = { path = "tools/clippy" }

src/bootstrap/dist.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ impl Step for Clippy {
12291229
let tmp = tmpdir(builder);
12301230
let image = tmp.join("clippy-image");
12311231
drop(fs::remove_dir_all(&image));
1232-
t!(fs::create_dir_all(&image));
1232+
builder.create_dir(&image);
12331233

12341234
// Prepare the image directory
12351235
// We expect clippy to build, because we've exited this step above if tool
@@ -1238,8 +1238,13 @@ impl Step for Clippy {
12381238
compiler: builder.compiler(stage, builder.config.build),
12391239
target, extra_features: Vec::new()
12401240
}).or_else(|| { println!("Unable to build clippy, skipping dist"); None })?;
1241+
let cargoclippy = builder.ensure(tool::CargoClippy {
1242+
compiler: builder.compiler(stage, builder.config.build),
1243+
target, extra_features: Vec::new()
1244+
}).or_else(|| { println!("Unable to build cargo clippy, skipping dist"); None })?;
12411245

12421246
builder.install(&clippy, &image.join("bin"), 0o755);
1247+
builder.install(&cargoclippy, &image.join("bin"), 0o755);
12431248
let doc = image.join("share/doc/clippy");
12441249
builder.install(&src.join("README.md"), &doc, 0o644);
12451250
builder.install(&src.join("LICENSE"), &doc, 0o644);

src/bootstrap/tool.rs

+16
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,14 @@ macro_rules! tool_extended {
584584

585585
tool_extended!((self, builder),
586586
Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", {};
587+
CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", {
588+
// Clippy depends on procedural macros (serde), which requires a full host
589+
// compiler to be available, so we need to depend on that.
590+
builder.ensure(compile::Rustc {
591+
compiler: self.compiler,
592+
target: builder.config.build,
593+
});
594+
};
587595
Clippy, clippy, "src/tools/clippy", "clippy-driver", {
588596
// Clippy depends on procedural macros (serde), which requires a full host
589597
// compiler to be available, so we need to depend on that.
@@ -594,6 +602,14 @@ tool_extended!((self, builder),
594602
};
595603
Miri, miri, "src/tools/miri", "miri", {};
596604
Rls, rls, "src/tools/rls", "rls", {
605+
let clippy = builder.ensure(Clippy {
606+
compiler: self.compiler,
607+
target: self.target,
608+
extra_features: Vec::new(),
609+
});
610+
if clippy.is_some() {
611+
self.extra_features.push("clippy".to_owned());
612+
}
597613
builder.ensure(native::Openssl {
598614
target: self.target,
599615
});

0 commit comments

Comments
 (0)