Skip to content

Commit

Permalink
Auto merge of #65630 - ecstatic-morse:graphviz-tidy, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Oct 21, 2019
2 parents 770b9e3 + efcae57 commit 1ba7b4e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ config.stamp
Session.vim
.cargo
no_llvm_build
# Generated when dumping Graphviz output for debugging:
/mir_dump/
/*.dot
24 changes: 24 additions & 0 deletions src/tools/tidy/src/debug_artifacts.rs
Original file line number Diff line number Diff line change
@@ -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);
}
}
});
}
1 change: 1 addition & 0 deletions src/tools/tidy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/tools/tidy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1ba7b4e

Please sign in to comment.