about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm_util.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-05-10 21:32:13 +0000
committerbors <bors@rust-lang.org>2021-05-10 21:32:13 +0000
commit79e50bf77928f374921a6bcafee3fcff1915f062 (patch)
tree6b110ba76f124b49d08038f30e73093b78e05211 /compiler/rustc_codegen_llvm/src/llvm_util.rs
parent6fd7a6dc0f5c4c8fd51d57c0f4f795d52481f904 (diff)
parent4d90635adc953f56d946925e56d189aabd4d3199 (diff)
downloadrust-79e50bf77928f374921a6bcafee3fcff1915f062.tar.gz
rust-79e50bf77928f374921a6bcafee3fcff1915f062.zip
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`.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
0 files changed, 0 insertions, 0 deletions