Skip to content

Commit 4a00e38

Browse files
committed
Migrate the target_policy check to diagnostics
1 parent d05266b commit 4a00e38

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/tools/tidy/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fn main() {
122122
check!(fluent_alphabetical, &compiler_path, bless);
123123
check!(fluent_period, &compiler_path);
124124
check!(fluent_lowercase, &compiler_path);
125-
// check!(target_policy, &root_path);
125+
check!(target_policy, &root_path);
126126
// check!(gcc_submodule, &root_path, &compiler_path);
127127

128128
// Checks that only make sense for the std libs.

src/tools/tidy/src/target_policy.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use std::collections::HashSet;
66
use std::path::Path;
77

8+
use crate::diagnostics::DiagCtx;
89
use crate::walk::{filter_not_rust, walk};
910

1011
const TARGET_DEFINITIONS_PATH: &str = "compiler/rustc_target/src/spec/targets/";
@@ -23,7 +24,9 @@ const EXCEPTIONS: &[&str] = &[
2324
"xtensa_esp32s3_espidf",
2425
];
2526

26-
pub fn check(root_path: &Path, bad: &mut bool) {
27+
pub fn check(root_path: &Path, diag_ctx: DiagCtx) {
28+
let mut check = diag_ctx.start_check("target_policy");
29+
2730
let mut targets_to_find = HashSet::new();
2831

2932
let definitions_path = root_path.join(TARGET_DEFINITIONS_PATH);
@@ -55,7 +58,7 @@ pub fn check(root_path: &Path, bad: &mut bool) {
5558

5659
for target in targets_to_find {
5760
if !EXCEPTIONS.contains(&target.as_str()) {
58-
tidy_error!(bad, "{ASSEMBLY_LLVM_TEST_PATH}: missing assembly test for {target}")
61+
check.error(format!("{ASSEMBLY_LLVM_TEST_PATH}: missing assembly test for {target}"));
5962
}
6063
}
6164
}

0 commit comments

Comments
 (0)