Skip to content

Commit b3e02c4

Browse files
authored
Merge pull request #20740 from rust-lang/rustc-pull
Rustc pull update
2 parents 5c62c90 + cd22123 commit b3e02c4

File tree

378 files changed

+10480
-3101
lines changed

Some content is hidden

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

378 files changed

+10480
-3101
lines changed

.github/workflows/ci.yml

Lines changed: 63 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
@@ -198,14 +239,14 @@ jobs:
198239
BRANCH="rustup-$(date -u +%Y-%m-%d)"
199240
git switch -c $BRANCH
200241
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.'
242+
gh pr create -B master --title 'Automatic Rustup' --body "Update \`rustc\` to https://github.com/rust-lang/rust/commit/$(cat rust-version)."
202243
env:
203-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
244+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
204245

205246
cron-fail-notify:
206247
name: cronjob failure notification
207248
runs-on: ubuntu-latest
208-
needs: [test, style, coverage]
249+
needs: [test, style, bootstrap, coverage]
209250
if: ${{ github.event_name == 'schedule' && failure() }}
210251
steps:
211252
# 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: 14 additions & 14 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 = "4.1.1", 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: 8 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
@@ -319,8 +319,14 @@ environment variable. We first document the most relevant and most commonly used
319319
Can be used without a value; in that case the range defaults to `0..64`.
320320
* `-Zmiri-many-seeds-keep-going` tells Miri to really try all the seeds in the given range, even if
321321
a failing seed has already been found. This is useful to determine which fraction of seeds fails.
322+
* `-Zmiri-max-extra-rounding-error` tells Miri to always apply the maximum error to float operations
323+
that do not have a guaranteed precision. The sign of the error is still non-deterministic.
322324
* `-Zmiri-no-extra-rounding-error` stops Miri from adding extra rounding errors to float operations
323325
that do not have a guaranteed precision.
326+
* `-Zmiri-no-short-fd-operations` stops Miri from artificially forcing `read`/`write` operations
327+
to only process a part of their buffer. Note that whenever Miri uses host operations to
328+
implement `read`/`write` (e.g. for file-backed file descriptors), the host system can still
329+
introduce short reads/writes.
324330
* `-Zmiri-num-cpus` states the number of available CPUs to be reported by miri. By default, the
325331
number of available CPUs is `1`. Note that this flag does not affect how miri handles threads in
326332
any way.
@@ -600,6 +606,7 @@ Definite bugs found:
600606
* [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)
601607
* [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)
602608
* [`ReentrantLock` not correctly dealing with reuse of addresses for TLS storage of different threads](https://github.com/rust-lang/rust/pull/141248)
609+
* [Rare Deadlock in the thread (un)parking example code](https://github.com/rust-lang/rust/issues/145816)
603610

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

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.

cargo-miri/src/phases.rs

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,6 @@ fn forward_patched_extern_arg(args: &mut impl Iterator<Item = String>, cmd: &mut
6565
}
6666

6767
pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
68-
// Check for version and help flags even when invoked as `cargo-miri`.
69-
if has_arg_flag("--help") || has_arg_flag("-h") {
70-
show_help();
71-
return;
72-
}
73-
if has_arg_flag("--version") || has_arg_flag("-V") {
74-
show_version();
75-
return;
76-
}
77-
7868
// Require a subcommand before any flags.
7969
// We cannot know which of those flags take arguments and which do not,
8070
// so we cannot detect subcommands later.
@@ -85,11 +75,36 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
8575
"setup" => MiriCommand::Setup,
8676
"test" | "t" | "run" | "r" | "nextest" => MiriCommand::Forward(subcommand),
8777
"clean" => MiriCommand::Clean,
88-
_ =>
78+
_ => {
79+
// Check for version and help flags.
80+
if has_arg_flag("--help") || has_arg_flag("-h") {
81+
show_help();
82+
return;
83+
}
84+
if has_arg_flag("--version") || has_arg_flag("-V") {
85+
show_version();
86+
return;
87+
}
8988
show_error!(
9089
"`cargo miri` supports the following subcommands: `run`, `test`, `nextest`, `clean`, and `setup`."
91-
),
90+
)
91+
}
9292
};
93+
if has_arg_flag("--help") || has_arg_flag("-h") {
94+
match subcommand {
95+
MiriCommand::Forward(verb) => {
96+
println!("`cargo miri {verb}` supports the same flags as `cargo {verb}`:\n");
97+
let mut cmd = cargo();
98+
cmd.arg(verb);
99+
cmd.arg("--help");
100+
exec(cmd);
101+
}
102+
_ => {
103+
show_help();
104+
return;
105+
}
106+
}
107+
}
93108
let verbose = num_arg_flag("-v") + num_arg_flag("--verbose");
94109
let quiet = has_arg_flag("-q") || has_arg_flag("--quiet");
95110

0 commit comments

Comments
 (0)