1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Named for its README badge.
name: miri
# Tests under Miri, which reports undefined behavior in the unsafe code.
# Only the tests .github/miri-nextest.toml names run, so that this runs on every
# change in minutes; normal test runs run them all.
on:
push:
branches:
pull_request:
workflow_dispatch:
# Cancel a pull request's superseded runs. Every commit on main finishes its
# run, so the README badge reports it.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
miri:
name: miri (tree borrows, strict provenance)
runs-on: ubuntu-latest
# The most a job may run on GitHub's runners.
timeout-minutes: 360
# Tree borrows rather than Miri's default, stacked borrows; and strict
# provenance: no integer becomes a pointer.
env:
MIRIFLAGS: -Zmiri-tree-borrows -Zmiri-strict-provenance
steps:
- uses: actions/checkout@v4
# Keep this exact nightly aligned with flake.nix.
- name: Install Rust (nightly-2026-10-07)
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2026-10-07
components: miri, rust-src
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- uses: Swatinem/rust-cache@v2
# A name that matches no test, say after a rename, would drop that
# test from Miri without a word.
- name: Check that every named test exists
run: |
named=$(grep -c 'test(=' .github/miri-nextest.toml)
found=$(cargo miri nextest list --config-file .github/miri-nextest.toml \
--message-format oneline | wc -l)
if [ "$named" -ne "$found" ]; then
echo "::error::.github/miri-nextest.toml names $named tests; $found exist"
exit 1
fi
# Miri interprets on one core. Nextest runs each test in a process of
# its own, so as many tests run at once as the runner has cores.
- name: Miri
run: |
cargo miri nextest run --config-file .github/miri-nextest.toml \
--test-threads "$(nproc)"