-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #84677 - CDirkx:pal, r=Mark-Simulacrum
Fix `tidy` platform-specific code check I noticed new platform-specific code was introduced outside of `std::sys` ([example](https://github.com/rust-lang/rust/blob/master/library/std/src/thread/available_concurrency.rs)), which should have been checked against by `tidy`. Apparently there are 2 problems with the current check implementation: - It ignores everything after encountering "mod tests", which is often at the very top of a file. - There was a bug where when checking the byte immediately before a found string, the first byte of the file was checked instead. I fixed the bug and made excluding tests a bit more robust by instead adding the following rules: - Files with a path containing either `tests` or `benches` are excluded. - A `cfg(...)` containing `test` is excluded. (Tests are excluded because almost all tests have something like `#[cfg(not(target_os = "emscripten"))]` somewhere.) The fixed check found some more cases of platform-specific code; for now I have explicitly excluded them and added a FIXME stating that the platform-specific code must be moved to `sys`.
- Loading branch information
Showing
1 changed file
with
28 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters