Skip to content

Commit 58d55d5

Browse files
committed
fix cargo fmt in ci to error on ice
1 parent 983abce commit 58d55d5

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/check-rust.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,22 @@ jobs:
4848
cache-on-failure: true
4949

5050
- name: cargo fmt
51-
run: cargo +nightly fmt --check --all
51+
run: |
52+
set -euo pipefail
53+
# Run cargo fmt and capture both stdout and stderr
54+
output=$(cargo +nightly fmt --check --all 2>&1) || {
55+
echo "❌ cargo fmt failed with non-zero exit code"
56+
echo "$output"
57+
exit 1
58+
}
59+
# Check for panic/ICE messages even if exit code was 0
60+
if echo "$output" | grep -qiE "(the compiler unexpectedly panicked|panicked at|Internal Compiler Error|ICE|error: the compiler unexpectedly panicked)"; then
61+
echo "❌ rustfmt panicked (ICE detected) - this should fail the build"
62+
echo "$output"
63+
exit 1
64+
fi
65+
echo "$output"
66+
echo "✅ cargo fmt completed successfully"
5267
5368
cargo-clippy-default-features:
5469
name: cargo clippy

0 commit comments

Comments
 (0)