Skip to content

Commit 76600cc

Browse files
authored
Merge branch 'master' into miri-memory
2 parents 8f13fb0 + 35cbdf8 commit 76600cc

File tree

450 files changed

+10005
-5288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

450 files changed

+10005
-5288
lines changed

.github/workflows/ci.yml

+18-12
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
env:
3333
HOST_TARGET: ${{ matrix.host_target }}
3434
steps:
35-
- uses: actions/checkout@v3
35+
- uses: actions/checkout@v4
3636

3737
- name: Show Rust version (stable toolchain)
3838
run: |
@@ -45,7 +45,7 @@ jobs:
4545
# over time).
4646
- name: Add cache for cargo
4747
id: cache
48-
uses: actions/cache@v3
48+
uses: actions/cache@v4
4949
with:
5050
path: |
5151
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
@@ -57,12 +57,12 @@ jobs:
5757
~/.cargo/bin
5858
~/.cargo/.crates.toml
5959
~/.cargo/.crates2.json
60-
key: cargo-${{ runner.os }}-reset20240331-${{ hashFiles('**/Cargo.lock') }}
61-
restore-keys: cargo-${{ runner.os }}-reset20240331
60+
key: cargo-${{ runner.os }}-reset20240425-${{ hashFiles('**/Cargo.lock') }}
61+
restore-keys: cargo-${{ runner.os }}-reset20240425
6262

63-
- name: Install rustup-toolchain-install-master
64-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
65-
run: cargo install -f rustup-toolchain-install-master
63+
- name: Install tools
64+
if: steps.cache.outputs.cache-hit != 'true'
65+
run: cargo install -f rustup-toolchain-install-master hyperfine
6666

6767
- name: Install miri toolchain
6868
run: |
@@ -78,14 +78,20 @@ jobs:
7878
rustc -Vv
7979
cargo -V
8080
81+
# The `style` job only runs on Linux; this makes sure the Windows-host-specific
82+
# code is also covered by clippy.
83+
- name: Check clippy
84+
if: matrix.os == 'windows-latest'
85+
run: ./miri clippy -- -D warnings
86+
8187
- name: Test Miri
8288
run: ./ci/ci.sh
8389

8490
style:
8591
name: style checks
8692
runs-on: ubuntu-latest
8793
steps:
88-
- uses: actions/checkout@v3
94+
- uses: actions/checkout@v4
8995

9096
# This is exactly duplicated from above. GHA is pretty terrible when it comes
9197
# to avoiding code duplication.
@@ -95,7 +101,7 @@ jobs:
95101
# over time).
96102
- name: Add cache for cargo
97103
id: cache
98-
uses: actions/cache@v3
104+
uses: actions/cache@v4
99105
with:
100106
path: |
101107
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
@@ -111,7 +117,7 @@ jobs:
111117
restore-keys: cargo-${{ runner.os }}-reset20240331
112118

113119
- name: Install rustup-toolchain-install-master
114-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
120+
if: steps.cache.outputs.cache-hit != 'true'
115121
run: cargo install -f rustup-toolchain-install-master
116122

117123
- name: Install "master" toolchain
@@ -165,7 +171,7 @@ jobs:
165171
name: cronjob failure notification
166172
runs-on: ubuntu-latest
167173
needs: [build, style]
168-
if: github.event_name == 'schedule' && (failure() || cancelled())
174+
if: github.event_name == 'schedule' && failure()
169175
steps:
170176
# Send a Zulip notification
171177
- name: Install zulip-send
@@ -191,7 +197,7 @@ jobs:
191197
The Miri Cronjobs Bot'
192198
193199
# Attempt to auto-sync with rustc
194-
- uses: actions/checkout@v3
200+
- uses: actions/checkout@v4
195201
with:
196202
fetch-depth: 256 # get a bit more of the history
197203
- name: install josh-proxy

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ tex/*/out
99
perf.data
1010
perf.data.old
1111
flamegraph.svg
12-
tests/extern-so/libtestlib.so
12+
tests/native-lib/libtestlib.so
1313
.auto-*

CONTRIBUTING.md

+44-7
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ For example:
7272

7373
You can (cross-)run the entire test suite using:
7474

75-
```
75+
```sh
7676
./miri test
77-
MIRI_TEST_TARGET=i686-unknown-linux-gnu ./miri test
77+
./miri test --target i686-unknown-linux-gnu
7878
```
7979

8080
`./miri test FILTER` only runs those tests that contain `FILTER` in their filename (including the
81-
base directory, e.g. `./miri test fail` will run all compile-fail tests). These filters are passed
82-
to `cargo test`, so for multiple filters you need to use `./miri test -- FILTER1 FILTER2`.
81+
base directory, e.g. `./miri test fail` will run all compile-fail tests). Multiple filters are
82+
supported: `./miri test FILTER1 FILTER2` runs all tests that contain either string.
8383

8484
#### Fine grained logging
8585

@@ -139,9 +139,8 @@ and then you can use it as if it was installed by `rustup` as a component of the
139139
in the `miri` toolchain's sysroot to prevent conflicts with other toolchains.
140140
The Miri binaries in the `cargo` bin directory (usually `~/.cargo/bin`) are managed by rustup.
141141

142-
There's a test for the cargo wrapper in the `test-cargo-miri` directory; run
143-
`./run-test.py` in there to execute it. Like `./miri test`, this respects the
144-
`MIRI_TEST_TARGET` environment variable to execute the test for another target.
142+
There's a test for the cargo wrapper in the `test-cargo-miri` directory; run `./run-test.py` in
143+
there to execute it. You can pass `--target` to execute the test for another target.
145144

146145
### Using a modified standard library
147146

@@ -287,3 +286,41 @@ https. Add the following to your `.gitconfig`:
287286
[url "git@github.com:"]
288287
pushInsteadOf = https://github.com/
289288
```
289+
290+
## Internal environment variables
291+
292+
The following environment variables are *internal* and must not be used by
293+
anyone but Miri itself. They are used to communicate between different Miri
294+
binaries, and as such worth documenting:
295+
296+
* `CARGO_EXTRA_FLAGS` is understood by `./miri` and passed to all host cargo invocations.
297+
* `MIRI_BE_RUSTC` can be set to `host` or `target`. It tells the Miri driver to
298+
actually not interpret the code but compile it like rustc would. With `target`, Miri sets
299+
some compiler flags to prepare the code for interpretation; with `host`, this is not done.
300+
This environment variable is useful to be sure that the compiled `rlib`s are compatible
301+
with Miri.
302+
* `MIRI_CALLED_FROM_SETUP` is set during the Miri sysroot build,
303+
which will re-invoke `cargo-miri` as the `rustc` to use for this build.
304+
* `MIRI_CALLED_FROM_RUSTDOC` when set to any value tells `cargo-miri` that it is
305+
running as a child process of `rustdoc`, which invokes it twice for each doc-test
306+
and requires special treatment, most notably a check-only build before interpretation.
307+
This is set by `cargo-miri` itself when running as a `rustdoc`-wrapper.
308+
* `MIRI_CWD` when set to any value tells the Miri driver to change to the given
309+
directory after loading all the source files, but before commencing
310+
interpretation. This is useful if the interpreted program wants a different
311+
working directory at run-time than at build-time.
312+
* `MIRI_LOCAL_CRATES` is set by `cargo-miri` to tell the Miri driver which
313+
crates should be given special treatment in diagnostics, in addition to the
314+
crate currently being compiled.
315+
* `MIRI_ORIG_RUSTDOC` is set and read by different phases of `cargo-miri` to remember the
316+
value of `RUSTDOC` from before it was overwritten.
317+
* `MIRI_REPLACE_LIBRS_IF_NOT_TEST` when set to any value enables a hack that helps bootstrap
318+
run the standard library tests in Miri.
319+
* `MIRI_TEST_TARGET` is set by `./miri test` (and `./x.py test miri`) to tell the test harness about
320+
the chosen target.
321+
* `MIRI_VERBOSE` when set to any value tells the various `cargo-miri` phases to
322+
perform verbose logging.
323+
* `MIRI_HOST_SYSROOT` is set by bootstrap to tell `cargo-miri` which sysroot to use for *host*
324+
operations.
325+
* `RUSTC_BLESS` is set by `./miri test` (and `./x.py test miri`) to indicate bless-mode to the test
326+
harness.

0 commit comments

Comments
 (0)