Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check all files in src/test for borrowck_graphviz_postflow #65630

Merged
merged 2 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +55 to +57
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be reverted. In fact I just removed these not too long ago.^^

I do sometimes create mir_dump folders during debugging, and those are junk that I want to clean up. They should not be automatically ignored by git. If you are okay with junk in your working dir, that's okay -- git has .git/info/exclude for you to locally configure stuff you want ignored. But please don't interfere with other people who want to keep their working dir clean.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In particular see the comment at the top of this file:

# This file should only ignore things that are generated during a build,
# generated by common IDEs, and optional files controlled by the user
# that affect the build (such as config.toml).

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