Skip to content

Commit cf4e094

Browse files
committed
Merge branch 'master' into tempfile
2 parents cff8bc2 + dcf1066 commit cf4e094

File tree

1,129 files changed

+29566
-6567
lines changed

Some content is hidden

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

1,129 files changed

+29566
-6567
lines changed

.github/workflows/ci.yml

+64-32
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,14 @@ on:
1010
branches:
1111
- 'master'
1212
schedule:
13-
- cron: '6 6 * * *' # At 6:06 UTC every day.
13+
- cron: '44 4 * * *' # At 4:44 UTC every day.
1414

15-
env:
16-
CARGO_UNSTABLE_SPARSE_REGISTRY: 'true'
15+
defaults:
16+
run:
17+
shell: bash
1718

1819
jobs:
1920
build:
20-
runs-on: ${{ matrix.os }}
21-
env:
22-
RUST_BACKTRACE: 1
23-
HOST_TARGET: ${{ matrix.host_target }}
2421
strategy:
2522
fail-fast: false
2623
matrix:
@@ -31,13 +28,13 @@ jobs:
3128
host_target: x86_64-apple-darwin
3229
- os: windows-latest
3330
host_target: i686-pc-windows-msvc
31+
runs-on: ${{ matrix.os }}
32+
env:
33+
RUST_BACKTRACE: 1
34+
HOST_TARGET: ${{ matrix.host_target }}
3435
steps:
3536
- uses: actions/checkout@v3
3637

37-
- name: Set the tag GC interval to 1 on linux
38-
if: runner.os == 'Linux'
39-
run: echo "MIRIFLAGS=-Zmiri-tag-gc=1" >> $GITHUB_ENV
40-
4138
# Cache the global cargo directory, but NOT the local `target` directory which
4239
# we cannot reuse anyway when the nightly changes (and it grows quite large
4340
# over time).
@@ -54,17 +51,14 @@ jobs:
5451
# contains package information of crates installed via `cargo install`.
5552
~/.cargo/.crates.toml
5653
~/.cargo/.crates2.json
57-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
58-
restore-keys: ${{ runner.os }}-cargo
54+
key: ${{ runner.os }}-cargo-reset20230315-${{ hashFiles('**/Cargo.lock') }}
55+
restore-keys: ${{ runner.os }}-cargo-reset20230315
5956

6057
- name: Install rustup-toolchain-install-master
6158
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
62-
shell: bash
63-
run: |
64-
cargo install -f rustup-toolchain-install-master
59+
run: cargo install -f rustup-toolchain-install-master
6560

6661
- name: Install "master" toolchain
67-
shell: bash
6862
run: |
6963
if [[ ${{ github.event_name }} == 'schedule' ]]; then
7064
echo "Building against latest rustc git version"
@@ -79,7 +73,7 @@ jobs:
7973
cargo -V
8074
8175
- name: Test
82-
run: bash ./ci.sh
76+
run: ./ci.sh
8377

8478
style:
8579
name: style checks
@@ -106,18 +100,19 @@ jobs:
106100
# contains package information of crates installed via `cargo install`.
107101
~/.cargo/.crates.toml
108102
~/.cargo/.crates2.json
109-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
110-
restore-keys: ${{ runner.os }}-cargo
103+
key: ${{ runner.os }}-cargo-reset20230315-${{ hashFiles('**/Cargo.lock') }}
104+
restore-keys: ${{ runner.os }}-cargo-reset20230315
111105

112106
- name: Install rustup-toolchain-install-master
113107
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
114-
shell: bash
115-
run: |
116-
cargo install -f rustup-toolchain-install-master
108+
run: cargo install -f rustup-toolchain-install-master
117109

118110
- name: Install "master" toolchain
119-
shell: bash
120111
run: |
112+
if [[ ${{ github.event_name }} == 'schedule' ]]; then
113+
echo "Building against latest rustc git version"
114+
git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1 > rust-version
115+
fi
121116
./miri toolchain
122117
123118
- name: Show Rust version
@@ -131,14 +126,13 @@ jobs:
131126
- name: clippy
132127
run: ./miri clippy -- -D warnings
133128
- name: rustdoc
134-
run: RUSTDOCFLAGS="-Dwarnings" cargo doc --document-private-items
129+
run: RUSTDOCFLAGS="-Dwarnings" ./miri cargo doc --document-private-items
135130

136131
# These jobs doesn't actually test anything, but they're only used to tell
137132
# bors the build completed, as there is no practical way to detect when a
138133
# workflow is successful listening to webhooks only.
139134
#
140135
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
141-
# (`fmt` is deliberately not listed, we want bors to ignore it.)
142136
end-success:
143137
name: bors build finished
144138
runs-on: ubuntu-latest
@@ -156,27 +150,65 @@ jobs:
156150
- name: mark the job as a failure
157151
run: exit 1
158152

159-
# Send a Zulip notification when a cron job fails
160153
cron-fail-notify:
161154
name: cronjob failure notification
162155
runs-on: ubuntu-latest
163156
needs: [build, style]
164157
if: github.event_name == 'schedule' && (failure() || cancelled())
165158
steps:
159+
# Send a Zulip notification
166160
- name: Install zulip-send
167161
run: pip3 install zulip
168162
- name: Send Zulip notification
169-
shell: bash
170163
env:
171164
ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }}
172165
ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }}
173166
run: |
174-
~/.local/bin/zulip-send --stream miri --subject "Cron Job Failure (miri, $(date -u +%Y-%m))" \
167+
~/.local/bin/zulip-send --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com \
168+
--stream miri --subject "Cron Job Failure (miri, $(date -u +%Y-%m))" \
175169
--message 'Dear @*T-miri*,
176170
177-
It would appear that the Miri cron job build failed. Would you mind investigating this issue?
171+
It would appear that the [Miri cron job build]('"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"') failed.
172+
173+
This likely means that rustc changed the miri directory and
174+
we now need to do a [`./miri rustc-pull`](https://github.com/rust-lang/miri/blob/master/CONTRIBUTING.md#importing-changes-from-the-rustc-repo).
175+
176+
Would you mind investigating this issue?
178177
179178
Thanks in advance!
180179
Sincerely,
181-
The Miri Cronjobs Bot' \
182-
--user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com
180+
The Miri Cronjobs Bot'
181+
182+
# Attempt to auto-sync with rustc
183+
- uses: actions/checkout@v3
184+
with:
185+
fetch-depth: 256 # get a bit more of the history
186+
- name: install josh-proxy
187+
run: RUSTFLAGS="--cap-lints warn" cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r22.12.06
188+
- name: setup bot git name and email
189+
run: |
190+
git config --global user.name 'The Miri Conjob Bot'
191+
git config --global user.email 'miri@cron.bot'
192+
- name: get changes from rustc
193+
run: ./miri rustc-pull
194+
- name: Install rustup-toolchain-install-master
195+
run: cargo install -f rustup-toolchain-install-master
196+
- name: format changes (if any)
197+
run: |
198+
./miri toolchain
199+
./miri fmt --check || (./miri fmt && git commit -am "fmt")
200+
- name: Push changes to a branch
201+
run: |
202+
BRANCH="rustup-$(date -u +%Y-%m-%d)"
203+
git switch -c $BRANCH
204+
git push -u origin $BRANCH
205+
- name: Create Pull Request
206+
run: |
207+
PR=$(gh pr create -B master --title 'Automatic Rustup' --body '')
208+
~/.local/bin/zulip-send --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com \
209+
--stream miri --subject "Cron Job Failure (miri, $(date -u +%Y-%m))" \
210+
--message "A PR doing a rustc-pull [has been automatically created]($PR) for your convenience."
211+
env:
212+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
213+
ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }}
214+
ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }}

CONTRIBUTING.md

+36-41
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,12 @@ and you can (cross-)run the entire test suite using:
7171
MIRI_TEST_TARGET=i686-unknown-linux-gnu ./miri test
7272
```
7373

74-
If your target doesn't support libstd, you can run miri with
74+
If your target doesn't support libstd that should usually just work. However, if you are using a
75+
custom target file, you might have to set `MIRI_NO_STD=1`.
7576

76-
```
77-
MIRI_NO_STD=1 MIRI_TEST_TARGET=thumbv7em-none-eabihf ./miri test tests/fail/alloc/no_global_allocator.rs
78-
MIRI_NO_STD=1 ./miri run tests/pass/no_std.rs --target thumbv7em-none-eabihf
79-
```
80-
81-
to avoid attempting (and failing) to build libstd. Note that almost no tests will pass
82-
this way, but you can run individual tests.
83-
84-
`./miri test FILTER` only runs those tests that contain `FILTER` in their
85-
filename (including the base directory, e.g. `./miri test fail` will run all
86-
compile-fail tests).
77+
`./miri test FILTER` only runs those tests that contain `FILTER` in their filename (including the
78+
base directory, e.g. `./miri test fail` will run all compile-fail tests). These filters are passed
79+
to `cargo test`, so for multiple filers you need to use `./miri test -- FILTER1 FILTER2`.
8780

8881
You can get a trace of which MIR statements are being executed by setting the
8982
`MIRI_LOG` environment variable. For example:
@@ -107,7 +100,7 @@ evaluation error was originally raised.
107100
### UI testing
108101

109102
We use ui-testing in Miri, meaning we generate `.stderr` and `.stdout` files for the output
110-
produced by Miri. You can use `./miri bless` to automatically (re)generate these files when
103+
produced by Miri. You can use `./miri test --bless` to automatically (re)generate these files when
111104
you add new tests or change how Miri presents certain output.
112105

113106
Note that when you also use `MIRIFLAGS` to change optimizations and similar, the ui output
@@ -116,7 +109,7 @@ to run the other checks while ignoring the ui output, use `MIRI_SKIP_UI_CHECKS=1
116109

117110
For more info on how to configure ui tests see [the documentation on the ui test crate][ui_test]
118111

119-
[ui_test]: ui_test/README.md
112+
[ui_test]: https://github.com/oli-obk/ui_test/blob/main/README.md
120113

121114
### Testing `cargo miri`
122115

@@ -129,18 +122,15 @@ development version of Miri using
129122
./miri install
130123
```
131124

132-
and then you can use it as if it was installed by `rustup`. Make sure you use
133-
the same toolchain when calling `cargo miri` that you used when installing Miri!
134-
Usually this means you have to write `cargo +miri miri ...` to select the `miri`
135-
toolchain that was installed by `./miri toolchain`.
125+
and then you can use it as if it was installed by `rustup` as a component of the
126+
`miri` toolchain. Note that the `miri` and `cargo-miri` executables are placed
127+
in the `miri` toolchain's sysroot to prevent conflicts with other toolchains.
128+
The Miri binaries in the `cargo` bin directory (usually `~/.cargo/bin`) are managed by rustup.
136129

137130
There's a test for the cargo wrapper in the `test-cargo-miri` directory; run
138131
`./run-test.py` in there to execute it. Like `./miri test`, this respects the
139132
`MIRI_TEST_TARGET` environment variable to execute the test for another target.
140133

141-
Note that installing Miri like this will "take away" Miri management from `rustup`.
142-
If you want to later go back to a rustup-installed Miri, run `rustup update`.
143-
144134
### Using a modified standard library
145135

146136
Miri re-builds the standard library into a custom sysroot, so it is fairly easy
@@ -168,16 +158,17 @@ to `.vscode/settings.json` in your local Miri clone:
168158
{
169159
"rust-analyzer.rustc.source": "discover",
170160
"rust-analyzer.linkedProjects": [
171-
"./Cargo.toml",
172-
"./cargo-miri/Cargo.toml"
161+
"Cargo.toml",
162+
"cargo-miri/Cargo.toml",
163+
"miri-script/Cargo.toml",
173164
],
174-
"rust-analyzer.checkOnSave.overrideCommand": [
165+
"rust-analyzer.check.overrideCommand": [
175166
"env",
176167
"MIRI_AUTO_OPS=no",
177168
"./miri",
178169
"cargo",
179170
"clippy", // make this `check` when working with a locally built rustc
180-
"--message-format=json"
171+
"--message-format=json",
181172
],
182173
// Contrary to what the name suggests, this also affects proc macros.
183174
"rust-analyzer.cargo.buildScripts.overrideCommand": [
@@ -232,19 +223,17 @@ You can also directly run Miri on a Rust source file:
232223

233224
## Advanced topic: Syncing with the rustc repo
234225

235-
We use the [`josh` proxy](https://github.com/josh-project/josh) to transmit
236-
changes between the rustc and Miri repositories. For now, the latest git version
237-
of josh needs to be built from source. This downloads and runs josh:
226+
We use the [`josh` proxy](https://github.com/josh-project/josh) to transmit changes between the
227+
rustc and Miri repositories. You can install it as follows:
238228

239229
```sh
240-
git clone https://github.com/josh-project/josh
241-
cd josh
242-
cargo run --release -p josh-proxy -- --local=local --remote=https://github.com --no-background
230+
cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r22.12.06
243231
```
244232

233+
Josh will automatically be started and stopped by `./miri`.
234+
245235
### Importing changes from the rustc repo
246236

247-
Josh needs to be running, as described above.
248237
We assume we start on an up-to-date master branch in the Miri repo.
249238

250239
```sh
@@ -263,16 +252,14 @@ needed.
263252

264253
### Exporting changes to the rustc repo
265254

266-
Keep in mind that pushing is the most complicated job that josh has to do --
267-
pulling just filters the rustc history, but pushing needs to construct a new
268-
rustc history that would filter to the given Miri history! To avoid problems, it
269-
is a good idea to always pull immediately before you push. In particular, you
270-
should never do two josh pushes without an intermediate pull; that can lead to
271-
duplicated commits.
255+
Keep in mind that pushing is the most complicated job that josh has to do -- pulling just filters
256+
the rustc history, but pushing needs to construct a new rustc history that would filter to the given
257+
Miri history! To avoid problems, it is a good idea to always pull immediately before you push. If
258+
you are getting strange errors, chances are you are running into [this josh
259+
bug](https://github.com/josh-project/josh/issues/998). In that case, please get in touch on Zulip.
272260

273-
Josh needs to be running, as described above. We will use the josh proxy to push
274-
to your fork of rustc. Run the following in the Miri repo, assuming we are on an
275-
up-to-date master branch:
261+
We will use the josh proxy to push to your fork of rustc. Run the following in the Miri repo,
262+
assuming we are on an up-to-date master branch:
276263

277264
```sh
278265
# Push the Miri changes to your rustc fork (substitute your github handle for YOUR_NAME).
@@ -282,3 +269,11 @@ up-to-date master branch:
282269
This will create a new branch called 'miri' in your fork, and the output should
283270
include a link to create a rustc PR that will integrate those changes into the
284271
main repository.
272+
273+
If this fails due to authentication problems, it can help to make josh push via ssh instead of
274+
https. Add the following to your `.gitconfig`:
275+
276+
```toml
277+
[url "git@github.com:"]
278+
pushInsteadOf = https://github.com/
279+
```

0 commit comments

Comments
 (0)