Skip to content

Commit 6c76dac

Browse files
authored
Rollup merge of #82507 - jyn514:tidy-windows, r=Mark-Simulacrum
Rename the `tidy` binary to `rust-tidy` This avoids naming collisions, particularly on Windows where the dynamic library variable is PATH and setting it causes the in-tree `tidy` to take precedence over the HTML tidy used by compiletest. This doesn't change the x.py interface in any way, it still accepts `x.py test tidy` and prints error messages about `tidy`. It only changes the name of the file on disk. Fixes #82501.
2 parents 9720cd1 + fe2b93b commit 6c76dac

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/bootstrap/tool.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl Step for ToolBuild {
4747
fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
4848
let compiler = self.compiler;
4949
let target = self.target;
50-
let tool = self.tool;
50+
let mut tool = self.tool;
5151
let path = self.path;
5252
let is_optional_tool = self.is_optional_tool;
5353

@@ -208,6 +208,12 @@ impl Step for ToolBuild {
208208
None
209209
}
210210
} else {
211+
// HACK(#82501): on Windows, the tools directory gets added to PATH when running tests, and
212+
// compiletest confuses HTML tidy with the in-tree tidy. Name the in-tree tidy something
213+
// different so the problem doesn't come up.
214+
if tool == "tidy" {
215+
tool = "rust-tidy";
216+
}
211217
let cargo_out =
212218
builder.cargo_out(compiler, self.mode, target).join(exe(tool, compiler.host));
213219
let bin = builder.tools_dir(compiler).join(exe(tool, compiler.host));

src/tools/tidy/Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ name = "tidy"
33
version = "0.1.0"
44
authors = ["Alex Crichton <[email protected]>"]
55
edition = "2018"
6+
autobins = false
67

78
[dependencies]
89
cargo_metadata = "0.11"
910
regex = "1"
1011
lazy_static = "1"
1112
walkdir = "2"
13+
14+
[[bin]]
15+
name = "rust-tidy"
16+
path = "src/main.rs"

0 commit comments

Comments
 (0)