Skip to content

Commit 27df91c

Browse files
committed
CI: Surface Rust warnings on PRs that touch any Rust code
Rust PRs will have a failed CI step if they trigger any warnings. This helps us stay on top of warnings from new Rust releases and also ones we accidentally write. Fix a typo for demo, since this only runs when Rust files are changed.
1 parent 61fff8a commit 27df91c

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Surface Rust warnings on PRs that touch any Rust code.
2+
# Not a required check so we never block people over new warnings
3+
# that might come from a new Rust version being released.
4+
name: Rust warnings
5+
on:
6+
pull_request:
7+
types:
8+
- opened
9+
- synchronize
10+
- reopened
11+
paths:
12+
- '**.rs'
13+
- '!**.inc.rs'
14+
merge_group:
15+
16+
concurrency:
17+
group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
18+
cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
make:
25+
env:
26+
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
27+
28+
runs-on: ubuntu-24.04
29+
30+
if: >-
31+
${{!(false
32+
|| contains(github.event.head_commit.message, '[DOC]')
33+
|| contains(github.event.head_commit.message, 'Document')
34+
|| contains(github.event.pull_request.title, '[DOC]')
35+
|| contains(github.event.pull_request.title, 'Document')
36+
|| contains(github.event.pull_request.labels.*.name, 'Documentation')
37+
|| (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
38+
)}}
39+
40+
steps:
41+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42+
43+
- name: Install Rust
44+
run: rustup default beta
45+
46+
- name: Rust warnings
47+
run: |
48+
set -euo pipefail
49+
cargo check --quiet --all-features --message-format=json \
50+
| jq -r 'select(.reason == "compiler-message" and .message.level == "warning") | .message.rendered' \
51+
> warnings.txt
52+
cat warnings.txt
53+
! grep --quiet '[^[:space:]]' warnings.txt

zjit/src/hir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ impl<'a> std::fmt::Display for ConstPrinter<'a> {
343343
///
344344
/// Because this is extra state external to any pointer being printed, a
345345
/// printing adapter struct that wraps the pointer along with this map is
346-
/// required to make use of this effectly. The [`std::fmt::Display`]
346+
/// required to make use of this effectively. The [`std::fmt::Display`]
347347
/// implementation on the adapter struct can then be reused to implement
348348
/// `Display` on the inner type with a default [`PtrPrintMap`], which
349349
/// does not perform any mapping.

0 commit comments

Comments
 (0)