Skip to content

Commit aa1c459

Browse files
committed
Auto merge of rust-lang#123557 - GuillaumeGomez:rollup-3af7urf, r=GuillaumeGomez
Rollup of 4 pull requests Successful merges: - rust-lang#123541 (remove miri-test-libstd hacks that are no longer needed) - rust-lang#123552 (Add missing -Zquery-dep-graph to the spike-neg incr comp tests) - rust-lang#123553 (Miri subtree update) - rust-lang#123554 (Simplify/cleanup `search-result-color.goml`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 773fb88 + 3a203b0 commit aa1c459

39 files changed

+1153
-1266
lines changed

library/alloc/src/lib.rs

-6
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@
5656
//! [`Rc`]: rc
5757
//! [`RefCell`]: core::cell
5858
59-
// To run alloc tests without x.py without ending up with two copies of alloc, Miri needs to be
60-
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
61-
// rustc itself never sets the feature, so this line has no effect there.
62-
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
63-
//
6459
#![allow(unused_attributes)]
6560
#![stable(feature = "alloc", since = "1.36.0")]
6661
#![doc(
@@ -71,7 +66,6 @@
7166
#![doc(cfg_hide(
7267
not(test),
7368
not(any(test, bootstrap)),
74-
any(not(feature = "miri-test-libstd"), test, doctest),
7569
no_global_oom_handling,
7670
not(no_global_oom_handling),
7771
not(no_rc),

library/core/src/lib.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@
5757
//
5858
// This cfg won't affect doc tests.
5959
#![cfg(not(test))]
60-
// To run core tests without x.py without ending up with two copies of core, Miri needs to be
61-
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
62-
// rustc itself never sets the feature, so this line has no effect there.
63-
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
60+
//
6461
#![stable(feature = "core", since = "1.6.0")]
6562
#![doc(
6663
html_playground_url = "https://play.rust-lang.org/",
@@ -71,7 +68,6 @@
7168
#![doc(rust_logo)]
7269
#![doc(cfg_hide(
7370
not(test),
74-
any(not(feature = "miri-test-libstd"), test, doctest),
7571
no_fp_fmt_parse,
7672
target_pointer_width = "16",
7773
target_pointer_width = "32",

library/std/src/lib.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,7 @@
212212
//! [rust-discord]: https://discord.gg/rust-lang
213213
//! [array]: prim@array
214214
//! [slice]: prim@slice
215-
// To run std tests without x.py without ending up with two copies of std, Miri needs to be
216-
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
217-
// rustc itself never sets the feature, so this line has no effect there.
218-
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
219-
// miri-test-libstd also prefers to make std use the sysroot versions of the dependencies.
220-
#![cfg_attr(feature = "miri-test-libstd", feature(rustc_private))]
221-
//
215+
222216
#![cfg_attr(not(feature = "restricted-std"), stable(feature = "rust1", since = "1.0.0"))]
223217
#![cfg_attr(feature = "restricted-std", unstable(feature = "restricted_std", issue = "none"))]
224218
#![cfg_attr(not(bootstrap), rustc_preserve_ub_checks)]

src/tools/miri/.github/workflows/ci.yml

+17-11
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
include:
2525
- os: ubuntu-latest
2626
host_target: x86_64-unknown-linux-gnu
27-
- os: macos-latest
28-
host_target: x86_64-apple-darwin
27+
- os: macos-14
28+
host_target: aarch64-apple-darwin
2929
- os: windows-latest
3030
host_target: i686-pc-windows-msvc
3131
runs-on: ${{ matrix.os }}
@@ -49,15 +49,16 @@ jobs:
4949
with:
5050
path: |
5151
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
52-
~/.cargo/bin
52+
# Cache package/registry information
5353
~/.cargo/registry/index
5454
~/.cargo/registry/cache
5555
~/.cargo/git/db
56-
# contains package information of crates installed via `cargo install`.
56+
# Cache installed binaries
57+
~/.cargo/bin
5758
~/.cargo/.crates.toml
5859
~/.cargo/.crates2.json
59-
key: ${{ runner.os }}-cargo-reset20230315-${{ hashFiles('**/Cargo.lock') }}
60-
restore-keys: ${{ runner.os }}-cargo-reset20230315
60+
key: cargo-${{ runner.os }}-reset20240331-${{ hashFiles('**/Cargo.lock') }}
61+
restore-keys: cargo-${{ runner.os }}-reset20240331
6162

6263
- name: Install rustup-toolchain-install-master
6364
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
@@ -98,15 +99,16 @@ jobs:
9899
with:
99100
path: |
100101
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
101-
~/.cargo/bin
102+
# Cache package/registry information
102103
~/.cargo/registry/index
103104
~/.cargo/registry/cache
104105
~/.cargo/git/db
105-
# contains package information of crates installed via `cargo install`.
106+
# Cache installed binaries
107+
~/.cargo/bin
106108
~/.cargo/.crates.toml
107109
~/.cargo/.crates2.json
108-
key: ${{ runner.os }}-cargo-reset20230315-${{ hashFiles('**/Cargo.lock') }}
109-
restore-keys: ${{ runner.os }}-cargo-reset20230315
110+
key: cargo-${{ runner.os }}-reset20240331-${{ hashFiles('**/Cargo.lock') }}
111+
restore-keys: cargo-${{ runner.os }}-reset20240331
110112

111113
- name: Install rustup-toolchain-install-master
112114
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
@@ -130,6 +132,10 @@ jobs:
130132
run: ./miri fmt --check
131133
- name: clippy
132134
run: ./miri clippy -- -D warnings
135+
- name: clippy (no features)
136+
run: ./miri clippy --no-default-features -- -D warnings
137+
- name: clippy (all features)
138+
run: ./miri clippy --all-features -- -D warnings
133139
- name: rustdoc
134140
run: RUSTDOCFLAGS="-Dwarnings" ./miri cargo doc --document-private-items
135141

@@ -189,7 +195,7 @@ jobs:
189195
with:
190196
fetch-depth: 256 # get a bit more of the history
191197
- name: install josh-proxy
192-
run: RUSTFLAGS="--cap-lints warn" cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r22.12.06
198+
run: RUSTFLAGS="--cap-lints warn" cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r23.12.04
193199
- name: setup bot git name and email
194200
run: |
195201
git config --global user.name 'The Miri Cronjob Bot'

src/tools/miri/CONTRIBUTING.md

+7-11
Original file line numberDiff line numberDiff line change
@@ -241,18 +241,20 @@ We use the [`josh` proxy](https://github.com/josh-project/josh) to transmit chan
241241
rustc and Miri repositories. You can install it as follows:
242242

243243
```sh
244-
cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r22.12.06
244+
RUSTFLAGS="--cap-lints=warn" cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r23.12.04
245245
```
246246

247247
Josh will automatically be started and stopped by `./miri`.
248248

249249
### Importing changes from the rustc repo
250250

251+
*Note: this usually happens automatically, so these steps rarely have to be done by hand.*
252+
251253
We assume we start on an up-to-date master branch in the Miri repo.
252254

253255
```sh
254256
# Fetch and merge rustc side of the history. Takes ca 5 min the first time.
255-
# This will also update the 'rustc-version' file.
257+
# This will also update the `rustc-version` file.
256258
./miri rustc-pull
257259
# Update local toolchain and apply formatting.
258260
./miri toolchain && ./miri fmt
@@ -266,12 +268,6 @@ needed.
266268

267269
### Exporting changes to the rustc repo
268270

269-
Keep in mind that pushing is the most complicated job that josh has to do -- pulling just filters
270-
the rustc history, but pushing needs to construct a new rustc history that would filter to the given
271-
Miri history! To avoid problems, it is a good idea to always pull immediately before you push. If
272-
you are getting strange errors, chances are you are running into [this josh
273-
bug](https://github.com/josh-project/josh/issues/998). In that case, please get in touch on Zulip.
274-
275271
We will use the josh proxy to push to your fork of rustc. Run the following in the Miri repo,
276272
assuming we are on an up-to-date master branch:
277273

@@ -280,9 +276,9 @@ assuming we are on an up-to-date master branch:
280276
./miri rustc-push YOUR_NAME miri
281277
```
282278

283-
This will create a new branch called 'miri' in your fork, and the output should
284-
include a link to create a rustc PR that will integrate those changes into the
285-
main repository.
279+
This will create a new branch called `miri` in your fork, and the output should include a link that
280+
creates a rustc PR to integrate those changes into the main repository. If that PR has conflicts,
281+
you need to pull rustc changes into Miri first, and then re-do the rustc push.
286282

287283
If this fails due to authentication problems, it can help to make josh push via ssh instead of
288284
https. Add the following to your `.gitconfig`:

src/tools/miri/ci/ci.sh

+57-45
Original file line numberDiff line numberDiff line change
@@ -27,60 +27,59 @@ export RUSTFLAGS="-D warnings"
2727
export CARGO_INCREMENTAL=0
2828
export CARGO_EXTRA_FLAGS="--locked"
2929

30-
# Determine configuration for installed build
30+
# Determine configuration for installed build (used by test-cargo-miri).
3131
echo "Installing release version of Miri"
32-
./miri install
33-
34-
echo "Checking various feature flag configurations"
35-
./miri check --no-default-features # make sure this can be built
36-
./miri check # and this, too
37-
# `--all-features` is used for the build below, so no extra check needed.
32+
time ./miri install
3833

3934
# Prepare debug build for direct `./miri` invocations.
4035
# We enable all features to make sure the Stacked Borrows consistency check runs.
4136
echo "Building debug version of Miri"
4237
export CARGO_EXTRA_FLAGS="$CARGO_EXTRA_FLAGS --all-features"
43-
./miri build --all-targets # the build that all the `./miri test` below will use
38+
time ./miri build --all-targets # the build that all the `./miri test` below will use
4439

4540
endgroup
4641

47-
# Test
42+
# Run tests. Recognizes these variables:
43+
# - MIRI_TEST_TARGET: the target to test. Empty for host target.
44+
# - GC_STRESS: if non-empty, run the GC stress test for the main test suite.
45+
# - MIR_OPT: if non-empty, re-run test `pass` tests with mir-opt-level=4
46+
# - MANY_SEEDS: if set to N, run the "many-seeds" tests N times
47+
# - TEST_BENCH: if non-empty, check that the benchmarks all build
48+
# - CARGO_MIRI_ENV: if non-empty, set some env vars and config to potentially confuse cargo-miri
4849
function run_tests {
49-
if [ -n "${MIRI_TEST_TARGET:-}" ]; then
50+
if [ -n "${MIRI_TEST_TARGET-}" ]; then
5051
begingroup "Testing foreign architecture $MIRI_TEST_TARGET"
5152
else
5253
begingroup "Testing host architecture"
5354
fi
5455

5556
## ui test suite
56-
# On the host, also stress-test the GC.
57-
if [ -z "${MIRI_TEST_TARGET:-}" ]; then
58-
MIRIFLAGS="${MIRIFLAGS:-} -Zmiri-provenance-gc=1" ./miri test
57+
if [ -n "${GC_STRESS-}" ]; then
58+
time MIRIFLAGS="${MIRIFLAGS-} -Zmiri-provenance-gc=1" ./miri test
5959
else
60-
./miri test
60+
time ./miri test
6161
fi
6262

63-
# Host-only tests
64-
if [ -z "${MIRI_TEST_TARGET:-}" ]; then
65-
# Running these on all targets is unlikely to catch more problems and would
66-
# cost a lot of CI time.
67-
63+
## advanced tests
64+
if [ -n "${MIR_OPT-}" ]; then
6865
# Tests with optimizations (`-O` is what cargo passes, but crank MIR optimizations up all the
6966
# way, too).
7067
# Optimizations change diagnostics (mostly backtraces), so we don't check
7168
# them. Also error locations change so we don't run the failing tests.
7269
# We explicitly enable debug-assertions here, they are disabled by -O but we have tests
7370
# which exist to check that we panic on debug assertion failures.
74-
MIRIFLAGS="${MIRIFLAGS:-} -O -Zmir-opt-level=4 -Cdebug-assertions=yes" MIRI_SKIP_UI_CHECKS=1 ./miri test -- tests/{pass,panic}
75-
71+
time MIRIFLAGS="${MIRIFLAGS-} -O -Zmir-opt-level=4 -Cdebug-assertions=yes" MIRI_SKIP_UI_CHECKS=1 ./miri test -- tests/{pass,panic}
72+
fi
73+
if [ -n "${MANY_SEEDS-}" ]; then
7674
# Also run some many-seeds tests. 64 seeds means this takes around a minute per test.
7775
# (Need to invoke via explicit `bash -c` for Windows.)
78-
for FILE in tests/many-seeds/*.rs; do
79-
MIRI_SEEDS=64 ./miri many-seeds "$BASH" -c "./miri run '$FILE'"
76+
time for FILE in tests/many-seeds/*.rs; do
77+
MIRI_SEEDS=$MANY_SEEDS ./miri many-seeds "$BASH" -c "./miri run '$FILE'"
8078
done
81-
79+
fi
80+
if [ -n "${TEST_BENCH-}" ]; then
8281
# Check that the benchmarks build and run, but without actually benchmarking.
83-
HYPERFINE="'$BASH' -c" ./miri bench
82+
time HYPERFINE="'$BASH' -c" ./miri bench
8483
fi
8584

8685
## test-cargo-miri
@@ -91,16 +90,18 @@ function run_tests {
9190
PYTHON=python
9291
fi
9392
# Some environment setup that attempts to confuse the heck out of cargo-miri.
94-
if [ "$HOST_TARGET" = x86_64-unknown-linux-gnu ]; then
95-
# These act up on Windows (`which miri` produces a filename that does not exist?!?),
96-
# so let's do this only on Linux. Also makes sure things work without these set.
97-
export RUSTC=$(which rustc) # Produces a warning unless we also set MIRI
93+
if [ -n "${CARGO_MIRI_ENV-}" ]; then
94+
# These act up on Windows (`which miri` produces a filename that does not exist?!?).
95+
# RUSTC is the main thing to set (it changes the first argument our wrapper will see).
96+
# Unless MIRI is also set, that produces a warning.
97+
export RUSTC=$(which rustc)
9898
export MIRI=$(rustc +miri --print sysroot)/bin/miri
99+
# We entirely ignore other wrappers.
100+
mkdir -p .cargo
101+
echo 'build.rustc-wrapper = "thisdoesnotexist"' > .cargo/config.toml
99102
fi
100-
mkdir -p .cargo
101-
echo 'build.rustc-wrapper = "thisdoesnotexist"' > .cargo/config.toml
102103
# Run the actual test
103-
${PYTHON} test-cargo-miri/run-test.py
104+
time ${PYTHON} test-cargo-miri/run-test.py
104105
# Clean up
105106
unset RUSTC MIRI
106107
rm -rf .cargo
@@ -109,7 +110,7 @@ function run_tests {
109110
}
110111

111112
function run_tests_minimal {
112-
if [ -n "${MIRI_TEST_TARGET:-}" ]; then
113+
if [ -n "${MIRI_TEST_TARGET-}" ]; then
113114
begingroup "Testing MINIMAL foreign architecture $MIRI_TEST_TARGET: only testing $@"
114115
else
115116
echo "run_tests_minimal requires MIRI_TEST_TARGET to be set"
@@ -126,38 +127,49 @@ function run_tests_minimal {
126127

127128
## Main Testing Logic ##
128129

129-
# Host target.
130-
run_tests
131-
132-
# Extra targets.
133130
# In particular, fully cover all tier 1 targets.
134131
case $HOST_TARGET in
135132
x86_64-unknown-linux-gnu)
133+
# Host
134+
GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
135+
# Extra tier 1
136136
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
137137
MIRI_TEST_TARGET=aarch64-unknown-linux-gnu run_tests
138-
MIRI_TEST_TARGET=aarch64-apple-darwin run_tests
138+
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
139139
MIRI_TEST_TARGET=i686-pc-windows-gnu run_tests
140140
MIRI_TEST_TARGET=x86_64-pc-windows-gnu run_tests
141+
# Extra tier 2
142+
MIRI_TEST_TARGET=aarch64-apple-darwin run_tests
141143
MIRI_TEST_TARGET=arm-unknown-linux-gnueabi run_tests
142-
# Some targets are only partially supported.
144+
# Partially supported targets (tier 2)
143145
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec panic/panic concurrency/simple pthread-threadname libc-getentropy libc-getrandom libc-misc libc-fs atomic env align num_cpus
144146
MIRI_TEST_TARGET=i686-unknown-freebsd run_tests_minimal hello integer vec panic/panic concurrency/simple pthread-threadname libc-getentropy libc-getrandom libc-misc libc-fs atomic env align num_cpus
145-
146147
MIRI_TEST_TARGET=aarch64-linux-android run_tests_minimal hello integer vec panic/panic
147148
MIRI_TEST_TARGET=wasm32-wasi run_tests_minimal no_std integer strings wasm
148149
MIRI_TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std integer strings wasm
149-
MIRI_TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std # no_std embedded architecture
150-
MIRI_TEST_TARGET=tests/avr.json MIRI_NO_STD=1 run_tests_minimal no_std # JSON target file
150+
MIRI_TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std
151+
# Custom target JSON file
152+
MIRI_TEST_TARGET=tests/avr.json MIRI_NO_STD=1 run_tests_minimal no_std
151153
;;
152-
x86_64-apple-darwin)
154+
aarch64-apple-darwin)
155+
# Host (tier 2)
156+
GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
157+
# Extra tier 1
158+
MIRI_TEST_TARGET=x86_64-pc-windows-msvc CARGO_MIRI_ENV=1 run_tests
159+
# Extra tier 2
153160
MIRI_TEST_TARGET=s390x-unknown-linux-gnu run_tests # big-endian architecture
154-
MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests
155161
;;
156162
i686-pc-windows-msvc)
163+
# Host
164+
# Only smoke-test `many-seeds`; 64 runs take 15min here!
165+
GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=1 TEST_BENCH=1 run_tests
166+
# Extra tier 1
167+
# We really want to ensure a Linux target works on a Windows host,
168+
# and a 64bit target works on a 32bit host.
157169
MIRI_TEST_TARGET=x86_64-unknown-linux-gnu run_tests
158170
;;
159171
*)
160-
echo "FATAL: unknown OS"
172+
echo "FATAL: unknown host target: $HOST_TARGET"
161173
exit 1
162174
;;
163175
esac

src/tools/miri/miri-script/src/commands.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ impl Command {
297297
};
298298
// Prepare the branch. Pushing works much better if we use as base exactly
299299
// the commit that we pulled from last time, so we use the `rust-version`
300-
// file as a good approximation of that.
300+
// file to find out which commit that would be.
301301
println!("Preparing {github_user}/rust (base: {base})...");
302302
if cmd!(sh, "git fetch https://github.com/{github_user}/rust {branch}")
303303
.ignore_stderr()

src/tools/miri/rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5baf1e13f568b61e121953bf6a3d09faee7dd446
1+
23d47dba319331d4418827cfbb8c1af283497d3c

src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl AccessCause {
4848
/// Complete data for an event:
4949
#[derive(Clone, Debug)]
5050
pub struct Event {
51-
/// Transformation of permissions that occured because of this event.
51+
/// Transformation of permissions that occurred because of this event.
5252
pub transition: PermTransition,
5353
/// Kind of the access that triggered this event.
5454
pub access_cause: AccessCause,
@@ -58,7 +58,7 @@ pub struct Event {
5858
/// `None` means that this is an implicit access to the entire allocation
5959
/// (used for the implicit read on protector release).
6060
pub access_range: Option<AllocRange>,
61-
/// The transition recorded by this event only occured on a subrange of
61+
/// The transition recorded by this event only occurred on a subrange of
6262
/// `access_range`: a single access on `access_range` triggers several events,
6363
/// each with their own mutually disjoint `transition_range`. No-op transitions
6464
/// should not be recorded as events, so the union of all `transition_range` is not

src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ impl Tree {
473473
let rperms = {
474474
let mut perms = UniValMap::default();
475475
// We manually set it to `Active` on all in-bounds positions.
476-
// We also ensure that it is initalized, so that no `Active` but
476+
// We also ensure that it is initialized, so that no `Active` but
477477
// not yet initialized nodes exist. Essentially, we pretend there
478478
// was a write that initialized these to `Active`.
479479
perms.insert(root_idx, LocationState::new_init(Permission::new_active()));

0 commit comments

Comments
 (0)