1use std::path::Path;
4
5use crate::diagnostics::{CheckId, DiagCtx};
6use crate::walk::*;
7
8pub fn check(filepath: &Path, diag_ctx: DiagCtx) {
9 let mut check = diag_ctx.start_check(CheckId::new("known_bug").path(filepath));
10 walk(filepath, |path, _is_dir| filter_not_rust(path), &mut |entry, contents| {
11 let file: &Path = entry.path();
12
13 let test_path_segments =
15 file.iter().map(|s| s.to_string_lossy().into()).collect::<Vec<String>>();
16 let test_path_segments_str =
17 test_path_segments.iter().map(|s| s.as_str()).collect::<Vec<&str>>();
18
19 if !matches!(
20 test_path_segments_str[..],
21 [.., "tests", "crashes", "auxiliary", _aux_file_rs]
22 ) && !contents.lines().any(|line| line.starts_with("//@ known-bug: "))
23 {
24 check.error(format!(
25 "{} crash/ice test does not have a \"//@ known-bug: \" directive",
26 file.display()
27 ));
28 }
29 });
30}