You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`.
0 commit comments