diff options
| author | bors <bors@rust-lang.org> | 2019-10-21 04:01:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-10-21 04:01:37 +0000 |
| commit | 1ba7b4ecefc64d89096501f59feb403e3c826d0f (patch) | |
| tree | 8b7f6822b1649df99cc1758c2c9c435b5205058a /src | |
| parent | 770b9e3012bd58bdf6046d328dabfd57df163eb6 (diff) | |
| parent | efcae577bf5ebf503a702c7e66c2924ddb53cdb8 (diff) | |
| download | rust-1ba7b4ecefc64d89096501f59feb403e3c826d0f.tar.gz rust-1ba7b4ecefc64d89096501f59feb403e3c826d0f.zip | |
Auto merge of #65630 - ecstatic-morse:graphviz-tidy, r=Mark-Simulacrum
Check all files in `src/test` for `borrowck_graphviz_postflow` This attribute causes DOT files to be generated in the top-level directory. It is intended to be used only temporarily and should never appear on master. This also tells git to ignore DOT files in the root or the `mir_dump` directory, which `-Z dump-mir` uses by default. This will prevent #65071 from occurring again. It needs to be merged after #65629, otherwise `tidy` will start failing. r? @Mark-Simulacrum
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/tidy/src/debug_artifacts.rs | 24 | ||||
| -rw-r--r-- | src/tools/tidy/src/lib.rs | 1 | ||||
| -rw-r--r-- | src/tools/tidy/src/main.rs | 1 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/tools/tidy/src/debug_artifacts.rs b/src/tools/tidy/src/debug_artifacts.rs new file mode 100644 index 00000000000..ee555a3e5bd --- /dev/null +++ b/src/tools/tidy/src/debug_artifacts.rs @@ -0,0 +1,24 @@ +//! Tidy check to prevent creation of unnecessary debug artifacts. + +use std::path::{Path, PathBuf}; + +const GRAPHVIZ_POSTFLOW_MSG: &'static str = + "`borrowck_graphviz_postflow` attribute in test"; + +pub fn check(path: &Path, bad: &mut bool) { + let test_dir: PathBuf = path.join("test"); + + super::walk(&test_dir, &mut super::filter_dirs, &mut |entry, contents| { + let filename = entry.path(); + let is_rust = filename.extension().map_or(false, |ext| ext == "rs"); + if !is_rust { + return; + } + + for (i, line) in contents.lines().enumerate() { + if line.contains("borrowck_graphviz_postflow") { + tidy_error!(bad, "{}:{}: {}", filename.display(), i + 1, GRAPHVIZ_POSTFLOW_MSG); + } + } + }); +} diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index eb93eb29747..c76cc4cff7f 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -31,6 +31,7 @@ macro_rules! tidy_error { pub mod bins; pub mod style; +pub mod debug_artifacts; pub mod errors; pub mod features; pub mod cargo; diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index e08c23c01fe..de6b0c5b28d 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -22,6 +22,7 @@ fn main() { let verbose = args.iter().any(|s| *s == "--verbose"); bins::check(&path, &mut bad); style::check(&path, &mut bad); + debug_artifacts::check(&path, &mut bad); errors::check(&path, &mut bad); cargo::check(&path, &mut bad); edition::check(&path, &mut bad); |
