Skip to content

Commit 7c6309b

Browse files
committed
Migrate the gcc_submodule check to diagnostics
1 parent 4a00e38 commit 7c6309b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/tools/tidy/src/gcc_submodule.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
use std::path::Path;
55
use std::process::Command;
66

7-
pub fn check(root_path: &Path, compiler_path: &Path, bad: &mut bool) {
7+
use crate::diagnostics::DiagCtx;
8+
9+
pub fn check(root_path: &Path, compiler_path: &Path, diag_ctx: DiagCtx) {
10+
let mut check = diag_ctx.start_check("gcc_submodule");
11+
812
let cg_gcc_version_path = compiler_path.join("rustc_codegen_gcc/libgccjit.version");
913
let cg_gcc_version = std::fs::read_to_string(&cg_gcc_version_path)
1014
.unwrap_or_else(|_| {
@@ -26,7 +30,7 @@ pub fn check(root_path: &Path, compiler_path: &Path, bad: &mut bool) {
2630

2731
// Git is not available or we are in a tarball
2832
if !git_output.status.success() {
29-
eprintln!("Cannot figure out the SHA of the GCC submodule");
33+
check.message("Cannot figure out the SHA of the GCC submodule");
3034
return;
3135
}
3236

@@ -43,12 +47,11 @@ pub fn check(root_path: &Path, compiler_path: &Path, bad: &mut bool) {
4347
// The SHA can start with + if the submodule is modified or - if it is not checked out.
4448
let gcc_submodule_sha = git_output.trim_start_matches(['+', '-']);
4549
if gcc_submodule_sha != cg_gcc_version {
46-
*bad = true;
47-
eprintln!(
50+
check.error(format!(
4851
r#"Commit SHA of the src/gcc submodule (`{gcc_submodule_sha}`) does not match the required GCC version of the GCC codegen backend (`{cg_gcc_version}`).
4952
Make sure to set the src/gcc submodule to commit {cg_gcc_version}.
5053
The GCC codegen backend commit is configured at {}."#,
5154
cg_gcc_version_path.display(),
52-
);
55+
));
5356
}
5457
}

src/tools/tidy/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ fn main() {
123123
check!(fluent_period, &compiler_path);
124124
check!(fluent_lowercase, &compiler_path);
125125
check!(target_policy, &root_path);
126-
// check!(gcc_submodule, &root_path, &compiler_path);
126+
check!(gcc_submodule, &root_path, &compiler_path);
127127

128128
// Checks that only make sense for the std libs.
129129
check!(pal, &library_path);

0 commit comments

Comments
 (0)