Skip to content

Commit 5f13ef8

Browse files
authored
Merge pull request #1950 from Kobzol/pull-nov-2025
rustc-pull
2 parents 90b8cc8 + 382e850 commit 5f13ef8

File tree

589 files changed

+14481
-4648
lines changed

Some content is hidden

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

589 files changed

+14481
-4648
lines changed

.github/workflows/ci.yml

Lines changed: 66 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,22 @@ jobs:
3131
os: ubuntu-24.04-arm
3232
multiarch: armhf
3333
gcc_cross: arm-linux-gnueabihf
34-
- host_target: riscv64gc-unknown-linux-gnu
35-
os: ubuntu-latest
36-
multiarch: riscv64
37-
gcc_cross: riscv64-linux-gnu
38-
qemu: true
39-
- host_target: s390x-unknown-linux-gnu
40-
os: ubuntu-latest
41-
multiarch: s390x
42-
gcc_cross: s390x-linux-gnu
43-
qemu: true
34+
# Disabled due to Ubuntu repo trouble
35+
# - host_target: riscv64gc-unknown-linux-gnu
36+
# os: ubuntu-latest
37+
# multiarch: riscv64
38+
# gcc_cross: riscv64-linux-gnu
39+
# qemu: true
40+
# - host_target: s390x-unknown-linux-gnu
41+
# os: ubuntu-latest
42+
# multiarch: s390x
43+
# gcc_cross: s390x-linux-gnu
44+
# qemu: true
45+
# - host_target: powerpc64le-unknown-linux-gnu
46+
# os: ubuntu-latest
47+
# multiarch: ppc64el
48+
# gcc_cross: powerpc64le-linux-gnu
49+
# qemu: true
4450
- host_target: aarch64-apple-darwin
4551
os: macos-latest
4652
- host_target: i686-pc-windows-msvc
@@ -62,19 +68,13 @@ jobs:
6268
- name: install multiarch
6369
if: ${{ matrix.multiarch != '' }}
6470
run: |
65-
# s390x, ppc64el need Ubuntu Ports to be in the mirror list
71+
# s390x, ppc64el, riscv64 need Ubuntu Ports to be in the mirror list
6672
sudo bash -c "echo 'https://ports.ubuntu.com/ priority:4' >> /etc/apt/apt-mirrors.txt"
6773
# Add architecture
6874
sudo dpkg --add-architecture ${{ matrix.multiarch }}
6975
sudo apt update
7076
# Install needed packages
7177
sudo apt install $(echo "libatomic1: zlib1g-dev:" | sed 's/:/:${{ matrix.multiarch }}/g')
72-
- name: Install rustup on Windows ARM
73-
if: ${{ matrix.os == 'windows-11-arm' }}
74-
run: |
75-
curl -LOs https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe
76-
./rustup-init.exe -y --no-modify-path
77-
echo "$USERPROFILE/.cargo/bin" >> "$GITHUB_PATH"
7878
- uses: ./.github/workflows/setup
7979
with:
8080
toolchain_flags: "--host ${{ matrix.host_target }}"
@@ -117,6 +117,41 @@ jobs:
117117
- name: rustdoc
118118
run: RUSTDOCFLAGS="-Dwarnings" ./miri doc --document-private-items
119119

120+
bootstrap:
121+
name: bootstrap build
122+
runs-on: ubuntu-latest
123+
steps:
124+
- uses: actions/checkout@v4
125+
# Deliberately skipping `./.github/workflows/setup` as we do our own setup
126+
- name: Add cache for cargo
127+
id: cache
128+
uses: actions/cache@v4
129+
with:
130+
path: |
131+
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
132+
# Cache package/registry information
133+
~/.cargo/registry/index
134+
~/.cargo/registry/cache
135+
~/.cargo/git/db
136+
# Cache bootstrap downloads
137+
../rust/build/cache
138+
key: cargo-bootstrap-${{ hashFiles('rust-version') }}
139+
restore-keys: cargo-bootstrap
140+
- name: prepare build environment
141+
run: |
142+
MIRIDIR=$(pwd)
143+
cd ..
144+
# Bootstrap needs at least depth 2 to function.
145+
git clone https://github.com/rust-lang/rust/ rust --depth 2 --revision $(cat "$MIRIDIR/rust-version")
146+
cd rust
147+
# Replace the in-tree Miri with the current version.
148+
rm src/tools/miri -rf
149+
ln -s "$MIRIDIR" src/tools/miri
150+
- name: check build
151+
run: |
152+
cd ../rust # ./x does not seem to like being invoked from elsewhere
153+
./x check miri
154+
120155
coverage:
121156
name: coverage report
122157
runs-on: ubuntu-latest
@@ -130,7 +165,7 @@ jobs:
130165
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
131166
# And they should be added below in `cron-fail-notify` as well.
132167
conclusion:
133-
needs: [test, style, coverage]
168+
needs: [test, style, bootstrap, coverage]
134169
# We need to ensure this job does *not* get skipped if its dependencies fail,
135170
# because a skipped job is considered a success by GitHub. So we have to
136171
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
@@ -169,7 +204,13 @@ jobs:
169204
run: rustup toolchain install nightly --profile minimal
170205
- name: Install rustup-toolchain-install-master
171206
run: cargo install -f rustup-toolchain-install-master
172-
- name: Push changes to a branch and create PR
207+
# Create a token for the next step so it can create a PR that actually runs CI.
208+
- uses: actions/create-github-app-token@v2
209+
id: app-token
210+
with:
211+
app-id: ${{ vars.APP_CLIENT_ID }}
212+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
213+
- name: pull changes from rustc and create PR
173214
run: |
174215
# Make it easier to see what happens.
175216
set -x
@@ -190,6 +231,9 @@ jobs:
190231
exit ${exitcode}
191232
fi
192233
234+
# Store merge commit message
235+
git log -1 --pretty=%B > message.txt
236+
193237
# Format changes
194238
./miri toolchain
195239
./miri fmt --check || (./miri fmt && git commit -am "fmt")
@@ -198,14 +242,14 @@ jobs:
198242
BRANCH="rustup-$(date -u +%Y-%m-%d)"
199243
git switch -c $BRANCH
200244
git push -u origin $BRANCH
201-
gh pr create -B master --title 'Automatic Rustup' --body 'Please close and re-open this PR to trigger CI, then enable auto-merge.'
245+
gh pr create -B master --title 'Automatic Rustup' --body-file message.txt
202246
env:
203-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
247+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
204248

205249
cron-fail-notify:
206250
name: cronjob failure notification
207251
runs-on: ubuntu-latest
208-
needs: [test, style, coverage]
252+
needs: [test, style, bootstrap, coverage]
209253
if: ${{ github.event_name == 'schedule' && failure() }}
210254
steps:
211255
# Send a Zulip notification

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ when installing the Miri toolchain. Alternatively, set the `RUSTUP_TOOLCHAIN` en
255255

256256
[`etc/rust_analyzer_helix.toml`]: https://github.com/rust-lang/miri/blob/master/etc/rust_analyzer_helix.toml
257257

258+
### Zed
259+
260+
Copy [`etc/rust_analyzer_zed.json`] to `.zed/settings.json` in the project root directory.
261+
262+
[`etc/rust_analyzer_zed.json`]: https://github.com/rust-lang/miri/blob/master/etc/rust_analyzer_zed.json
263+
258264
### Advanced configuration
259265

260266
If you are building Miri with a locally built rustc, set

Cargo.lock

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ features = ['unprefixed_malloc_on_supported_platforms']
3939
[target.'cfg(unix)'.dependencies]
4040
libc = "0.2"
4141
# native-lib dependencies
42-
libffi = { version = "4.0.0", optional = true }
42+
libffi = { version = "5.0.0", optional = true }
4343
libloading = { version = "0.8", optional = true }
4444
serde = { version = "1.0.219", features = ["derive"], optional = true }
4545

@@ -70,14 +70,15 @@ harness = false
7070

7171
[features]
7272
default = ["stack-cache", "native-lib"]
73-
genmc = ["dep:genmc-sys"] # this enables a GPL dependency!
73+
genmc = ["dep:genmc-sys"]
7474
stack-cache = []
7575
stack-cache-consistency-check = ["stack-cache"]
7676
tracing = ["serde_json"]
7777
native-lib = ["dep:libffi", "dep:libloading", "dep:capstone", "dep:ipc-channel", "dep:nix", "dep:serde"]
7878

7979
[lints.rust.unexpected_cfgs]
8080
level = "warn"
81+
check-cfg = ['cfg(bootstrap)']
8182

8283
# Be aware that this file is inside a workspace when used via the
8384
# submodule in the rustc repo. That means there are many cargo features

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ degree documented below):
220220
- `solaris` / `illumos`: maintained by @devnexen. Supports the entire test suite.
221221
- `freebsd`: maintained by @YohDeadfall and @LorrensP-2158466. Supports the entire test suite.
222222
- `android`: **maintainer wanted**. Support very incomplete, but a basic "hello world" works.
223-
- `wasi`: **maintainer wanted**. Support very incomplete, not even standard output works, but an empty `main` function works.
223+
- `wasi`: **maintainer wanted**. Support very incomplete, but a basic "hello world" works.
224224
- For targets on other operating systems, Miri might fail before even reaching the `main` function.
225225

226226
However, even for targets that we do support, the degree of support for accessing platform APIs
@@ -246,6 +246,21 @@ such races.
246246

247247
Note: `cargo-nextest` does not support doctests, see https://github.com/nextest-rs/nextest/issues/16
248248

249+
### Directly invoking the `miri` driver
250+
251+
The recommended way to invoke Miri is via `cargo miri`. Directly invoking the underlying `miri`
252+
driver is not supported, which is why that binary is not even installed into the PATH. However, if
253+
you need to run Miri on many small tests and want to invoke it directly like you would invoke
254+
`rustc`, that is still possible with a bit of extra effort:
255+
256+
```sh
257+
# one-time setup
258+
cargo +nightly miri setup
259+
SYSROOT=$(cargo +nightly miri setup --print-sysroot)
260+
# per file
261+
~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/miri --sysroot "$SYSROOT" file.rs
262+
```
263+
249264
### Common Problems
250265

251266
When using the above instructions, you may encounter a number of confusing compiler
@@ -319,8 +334,14 @@ environment variable. We first document the most relevant and most commonly used
319334
Can be used without a value; in that case the range defaults to `0..64`.
320335
* `-Zmiri-many-seeds-keep-going` tells Miri to really try all the seeds in the given range, even if
321336
a failing seed has already been found. This is useful to determine which fraction of seeds fails.
337+
* `-Zmiri-max-extra-rounding-error` tells Miri to always apply the maximum error to float operations
338+
that do not have a guaranteed precision. The sign of the error is still non-deterministic.
322339
* `-Zmiri-no-extra-rounding-error` stops Miri from adding extra rounding errors to float operations
323340
that do not have a guaranteed precision.
341+
* `-Zmiri-no-short-fd-operations` stops Miri from artificially forcing `read`/`write` operations
342+
to only process a part of their buffer. Note that whenever Miri uses host operations to
343+
implement `read`/`write` (e.g. for file-backed file descriptors), the host system can still
344+
introduce short reads/writes.
324345
* `-Zmiri-num-cpus` states the number of available CPUs to be reported by miri. By default, the
325346
number of available CPUs is `1`. Note that this flag does not affect how miri handles threads in
326347
any way.
@@ -600,6 +621,7 @@ Definite bugs found:
600621
* [A bug in the new `RwLock::downgrade` implementation](https://rust-lang.zulipchat.com/#narrow/channel/269128-miri/topic/Miri.20error.20library.20test) (caught by Miri before it landed in the Rust repo)
601622
* [Mockall reading uninitialized memory when mocking `std::io::Read::read`, even if all expectations are satisfied](https://github.com/asomers/mockall/issues/647) (caught by Miri running Tokio's test suite)
602623
* [`ReentrantLock` not correctly dealing with reuse of addresses for TLS storage of different threads](https://github.com/rust-lang/rust/pull/141248)
624+
* [Rare Deadlock in the thread (un)parking example code](https://github.com/rust-lang/rust/issues/145816)
603625

604626
Violations of [Stacked Borrows] found that are likely bugs (but Stacked Borrows is currently just an experiment):
605627

cargo-miri/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cargo-miri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ directories = "6"
1818
rustc_version = "0.4"
1919
serde_json = "1.0.40"
2020
cargo_metadata = "0.21"
21-
rustc-build-sysroot = "0.5.8"
21+
rustc-build-sysroot = "0.5.10"
2222

2323
# Enable some feature flags that dev-dependencies need but dependencies
2424
# do not. This makes `./miri install` after `./miri build` faster.

0 commit comments

Comments
 (0)