Skip to content

Commit 5bf139e

Browse files
committed
Auto merge of #109440 - WaffleLapkin:make_tidy_slower, r=jyn514
Don't skip all directories when tidy-checking This fixes a regression from #108772 which basically made it that tidy style checks only `README.md` and `COMPILER_TESTS.md`.
2 parents 2036fdd + 904dd2c commit 5bf139e

File tree

23 files changed

+87
-67
lines changed

23 files changed

+87
-67
lines changed

compiler/rustc_attr/src/builtin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl UnstableReason {
227227
}
228228

229229
/// Collects stability info from `stable`/`unstable`/`rustc_allowed_through_unstable_modules`
230-
/// attributes in `attrs`. Returns `None` if no stability attributes are found.
230+
/// attributes in `attrs`. Returns `None` if no stability attributes are found.
231231
pub fn find_stability(
232232
sess: &Session,
233233
attrs: &[Attribute],
@@ -281,7 +281,7 @@ pub fn find_stability(
281281
}
282282

283283
/// Collects stability info from `rustc_const_stable`/`rustc_const_unstable`/`rustc_promotable`
284-
/// attributes in `attrs`. Returns `None` if no stability attributes are found.
284+
/// attributes in `attrs`. Returns `None` if no stability attributes are found.
285285
pub fn find_const_stability(
286286
sess: &Session,
287287
attrs: &[Attribute],

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,7 @@ impl<'a> Linker for AixLinker<'a> {
16211621
let path = tmpdir.join("list.exp");
16221622
let res: io::Result<()> = try {
16231623
let mut f = BufWriter::new(File::create(&path)?);
1624-
// TODO: use llvm-nm to generate export list.
1624+
// FIXME: use llvm-nm to generate export list.
16251625
for symbol in symbols {
16261626
debug!(" _{}", symbol);
16271627
writeln!(f, " {}", symbol)?;

compiler/rustc_error_codes/src/error_codes/E0080.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ or causing an integer overflow are two ways to induce this error.
1616
Ensure that the expressions given can be evaluated as the desired integer type.
1717

1818
See the [Discriminants] section of the Reference for more information about
19-
setting custom integer types on enums using the [`repr` attribute][repr-attribute].
19+
setting custom integer types on enums using the
20+
[`repr` attribute][repr-attribute].
2021

2122
[discriminants]: https://doc.rust-lang.org/reference/items/enumerations.html#discriminants
2223
[repr-attribute]: https://doc.rust-lang.org/reference/type-layout.html#representations

compiler/rustc_error_codes/src/error_codes/E0794.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ In the definition of `bar`, the lifetime parameter `'a` is late-bound, while
5959
where `'a` is universally quantified and `'b` is substituted by a specific
6060
lifetime. It is not allowed to explicitly specify early-bound lifetime
6161
arguments when late-bound lifetime parameters are present (as for `bar_fn2`,
62-
see [issue #42868](https://github.com/rust-lang/rust/issues/42868)), although the
63-
types that are constrained by early-bound parameters can be specified (as for
64-
`bar_fn3`).
62+
see [issue #42868](https://github.com/rust-lang/rust/issues/42868)), although
63+
the types that are constrained by early-bound parameters can be specified (as
64+
for `bar_fn3`).

compiler/rustc_mir_build/src/build/expr/as_rvalue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
568568
BinOp::Shl | BinOp::Shr if self.check_overflow && ty.is_integral() => {
569569
// For an unsigned RHS, the shift is in-range for `rhs < bits`.
570570
// For a signed RHS, `IntToInt` cast to the equivalent unsigned
571-
// type and do that same comparison. Because the type is the
571+
// type and do that same comparison. Because the type is the
572572
// same size, there's no negative shift amount that ends up
573573
// overlapping with valid ones, thus it catches negatives too.
574574
let (lhs_size, _) = ty.int_size_and_signed(self.tcx);

src/doc/unstable-book/src/compiler-flags/sanitizer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ See the [Clang ControlFlowIntegrity documentation][clang-cfi] for more details.
213213
214214
## Example
215215
216-
```rust,ignore
216+
```rust,ignore (making doc tests pass cross-platform is hard)
217217
#![feature(naked_functions)]
218218
219219
use std::arch::asm;

src/tools/replace-version-placeholder/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn main() {
1010
let version_str = version_str.trim();
1111
walk::walk(
1212
&root_path,
13-
|path| {
13+
|path, _is_dir| {
1414
walk::filter_dirs(path)
1515
// We exempt these as they require the placeholder
1616
// for their operation

src/tools/tidy/src/alphabetical.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ fn check_section<'a>(
9595
}
9696

9797
pub fn check(path: &Path, bad: &mut bool) {
98-
walk(path, filter_dirs, &mut |entry, contents| {
98+
walk(path, |path, _is_dir| filter_dirs(path), &mut |entry, contents| {
9999
let file = &entry.path().display();
100100

101101
let mut lines = contents.lines().enumerate().peekable();

src/tools/tidy/src/bins.rs

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -103,36 +103,40 @@ mod os_impl {
103103

104104
// FIXME: we don't need to look at all binaries, only files that have been modified in this branch
105105
// (e.g. using `git ls-files`).
106-
walk_no_read(&[path], |path| filter_dirs(path) || path.ends_with("src/etc"), &mut |entry| {
107-
let file = entry.path();
108-
let extension = file.extension();
109-
let scripts = ["py", "sh", "ps1"];
110-
if scripts.into_iter().any(|e| extension == Some(OsStr::new(e))) {
111-
return;
112-
}
113-
114-
if t!(is_executable(&file), file) {
115-
let rel_path = file.strip_prefix(path).unwrap();
116-
let git_friendly_path = rel_path.to_str().unwrap().replace("\\", "/");
117-
118-
if ALLOWED.contains(&git_friendly_path.as_str()) {
106+
walk_no_read(
107+
&[path],
108+
|path, _is_dir| filter_dirs(path) || path.ends_with("src/etc"),
109+
&mut |entry| {
110+
let file = entry.path();
111+
let extension = file.extension();
112+
let scripts = ["py", "sh", "ps1"];
113+
if scripts.into_iter().any(|e| extension == Some(OsStr::new(e))) {
119114
return;
120115
}
121116

122-
let output = Command::new("git")
123-
.arg("ls-files")
124-
.arg(&git_friendly_path)
125-
.current_dir(path)
126-
.stderr(Stdio::null())
127-
.output()
128-
.unwrap_or_else(|e| {
129-
panic!("could not run git ls-files: {e}");
130-
});
131-
let path_bytes = rel_path.as_os_str().as_bytes();
132-
if output.status.success() && output.stdout.starts_with(path_bytes) {
133-
tidy_error!(bad, "binary checked into source: {}", file.display());
117+
if t!(is_executable(&file), file) {
118+
let rel_path = file.strip_prefix(path).unwrap();
119+
let git_friendly_path = rel_path.to_str().unwrap().replace("\\", "/");
120+
121+
if ALLOWED.contains(&git_friendly_path.as_str()) {
122+
return;
123+
}
124+
125+
let output = Command::new("git")
126+
.arg("ls-files")
127+
.arg(&git_friendly_path)
128+
.current_dir(path)
129+
.stderr(Stdio::null())
130+
.output()
131+
.unwrap_or_else(|e| {
132+
panic!("could not run git ls-files: {e}");
133+
});
134+
let path_bytes = rel_path.as_os_str().as_bytes();
135+
if output.status.success() && output.stdout.starts_with(path_bytes) {
136+
tidy_error!(bad, "binary checked into source: {}", file.display());
137+
}
134138
}
135-
}
136-
})
139+
},
140+
)
137141
}
138142
}

src/tools/tidy/src/debug_artifacts.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,21 @@ use std::path::Path;
66
const GRAPHVIZ_POSTFLOW_MSG: &str = "`borrowck_graphviz_postflow` attribute in test";
77

88
pub fn check(test_dir: &Path, bad: &mut bool) {
9-
walk(test_dir, |path| filter_dirs(path) || filter_not_rust(path), &mut |entry, contents| {
10-
for (i, line) in contents.lines().enumerate() {
11-
if line.contains("borrowck_graphviz_postflow") {
12-
tidy_error!(bad, "{}:{}: {}", entry.path().display(), i + 1, GRAPHVIZ_POSTFLOW_MSG);
9+
walk(
10+
test_dir,
11+
|path, _is_dir| filter_dirs(path) || filter_not_rust(path),
12+
&mut |entry, contents| {
13+
for (i, line) in contents.lines().enumerate() {
14+
if line.contains("borrowck_graphviz_postflow") {
15+
tidy_error!(
16+
bad,
17+
"{}:{}: {}",
18+
entry.path().display(),
19+
i + 1,
20+
GRAPHVIZ_POSTFLOW_MSG
21+
);
22+
}
1323
}
14-
}
15-
});
24+
},
25+
);
1626
}

0 commit comments

Comments
 (0)