Skip to content

Commit 3ca2a42

Browse files
committed
Merge from rustc
2 parents 2aa579f + 53a1b3d commit 3ca2a42

File tree

8 files changed

+39
-77
lines changed

8 files changed

+39
-77
lines changed

Diff for: src/building/optimized-build.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@ Here is an example of how can `opt-dist` be used locally (outside of CI):
126126
[`Environment`]: https://github.com/rust-lang/rust/blob/ee451f8faccf3050c76cdcd82543c917b40c7962/src/tools/opt-dist/src/environment.rs#L5
127127

128128
> Note: if you want to run the actual CI pipeline, instead of running `opt-dist` locally,
129-
> you can execute `python3 src/ci/github-actions/ci.py run-local dist-x86_64-linux`.
129+
> you can execute `cargo run --manifest-path src/ci/citool/Cargo.toml run-local dist-x86_64-linux`.

Diff for: src/hir.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ defined in the map. By matching on this, you can find out what sort of
139139
node the `HirId` referred to and also get a pointer to the data
140140
itself. Often, you know what sort of node `n` is – e.g. if you know
141141
that `n` must be some HIR expression, you can do
142-
[`tcx.hir().expect_expr(n)`][expect_expr], which will extract and return the
142+
[`tcx.hir_expect_expr(n)`][expect_expr], which will extract and return the
143143
[`&hir::Expr`][Expr], panicking if `n` is not in fact an expression.
144144

145145
[find]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.find
146146
[`Node`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/enum.Node.html
147-
[expect_expr]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.expect_expr
147+
[expect_expr]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.expect_expr
148148
[Expr]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.Expr.html
149149

150150
Finally, you can use the HIR map to find the parents of nodes, via

Diff for: src/parallel-rustc.md

-2
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ are implemented differently depending on whether `parallel-compiler` is true.
4646

4747
| data structure | parallel | non-parallel |
4848
| -------------------------------- | --------------------------------------------------- | ------------ |
49-
| OnceCell | std::sync::OnceLock | std::cell::OnceCell |
5049
| Lock\<T> | (parking_lot::Mutex\<T>) | (std::cell::RefCell) |
5150
| RwLock\<T> | (parking_lot::RwLock\<T>) | (std::cell::RefCell) |
52-
| MTRef<'a, T> | &'a T | &'a mut T |
5351
| MTLock\<T> | (Lock\<T>) | (T) |
5452
| ReadGuard | parking_lot::RwLockReadGuard | std::cell::Ref |
5553
| MappedReadGuard | parking_lot::MappedRwLockReadGuard | std::cell::Ref |

Diff for: src/tests/ci.md

+21-13
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Our CI is primarily executed on [GitHub Actions], with a single workflow defined
2828
in [`.github/workflows/ci.yml`], which contains a bunch of steps that are
2929
unified for all CI jobs that we execute. When a commit is pushed to a
3030
corresponding branch or a PR, the workflow executes the
31-
[`src/ci/github-actions/ci.py`] script, which dynamically generates the specific CI
31+
[`src/ci/citool`] crate, which dynamically generates the specific CI
3232
jobs that should be executed. This script uses the [`jobs.yml`] file as an
3333
input, which contains a declarative configuration of all our CI jobs.
3434

@@ -133,29 +133,37 @@ There are several use-cases for try builds:
133133
Again, a working compiler build is needed for this, which can be produced by
134134
the [dist-x86_64-linux] CI job.
135135
- Run a specific CI job (e.g. Windows tests) on a PR, to quickly test if it
136-
passes the test suite executed by that job. You can select which CI jobs will
137-
be executed in the try build by adding up to 10 lines containing `try-job:
138-
<name of job>` to the PR description. All such specified jobs will be executed
139-
in the try build once the `@bors try` command is used on the PR. If no try
140-
jobs are specified in this way, the jobs defined in the `try` section of
141-
[`jobs.yml`] will be executed by default.
136+
passes the test suite executed by that job.
137+
138+
You can select which CI jobs will
139+
be executed in the try build by adding lines containing `try-job:
140+
<job pattern>` to the PR description. All such specified jobs will be executed
141+
in the try build once the `@bors try` command is used on the PR. If no try
142+
jobs are specified in this way, the jobs defined in the `try` section of
143+
[`jobs.yml`] will be executed by default.
144+
145+
Each pattern can either be an exact name of a job or a glob pattern that matches multiple jobs,
146+
for example `*msvc*` or `*-alt`. You can start at most 20 jobs in a single try build. When using
147+
glob patterns, you might want to wrap them in backticks (`` ` ``) to avoid GitHub rendering
148+
the pattern as Markdown.
142149

143150
> **Using `try-job` PR description directives**
144151
>
145-
> 1. Identify which set of try-jobs (max 10) you would like to exercise. You can
152+
> 1. Identify which set of try-jobs you would like to exercise. You can
146153
> find the name of the CI jobs in [`jobs.yml`].
147154
>
148-
> 2. Amend PR description to include (usually at the end of the PR description)
149-
> e.g.
155+
> 2. Amend PR description to include a set of patterns (usually at the end
156+
> of the PR description), for example:
150157
>
151158
> ```text
152159
> This PR fixes #123456.
153160
>
154161
> try-job: x86_64-msvc
155162
> try-job: test-various
163+
> try-job: `*-alt`
156164
> ```
157165
>
158-
> Each `try-job` directive must be on its own line.
166+
> Each `try-job` pattern must be on its own line.
159167
>
160168
> 3. Run the prescribed try jobs with `@bors try`. As aforementioned, this
161169
> requires the user to either (1) have `try` permissions or (2) be delegated
@@ -299,7 +307,7 @@ platform’s custom [Docker container]. This has a lot of advantages for us:
299307
- We can avoid reinstalling tools (like QEMU or the Android emulator) every time
300308
thanks to Docker image caching.
301309
- Users can run the same tests in the same environment locally by just running
302-
`python3 src/ci/github-actions/ci.py run-local <job-name>`, which is awesome to debug failures. Note that there are only linux docker images available locally due to licensing and
310+
`cargo run --manifest-path src/ci/citool/Cargo.toml run-local <job-name>`, which is awesome to debug failures. Note that there are only linux docker images available locally due to licensing and
303311
other restrictions.
304312

305313
The docker images prefixed with `dist-` are used for building artifacts while
@@ -443,7 +451,7 @@ this:
443451
[GitHub Actions]: https://github.com/rust-lang/rust/actions
444452
[`jobs.yml`]: https://github.com/rust-lang/rust/blob/master/src/ci/github-actions/jobs.yml
445453
[`.github/workflows/ci.yml`]: https://github.com/rust-lang/rust/blob/master/.github/workflows/ci.yml
446-
[`src/ci/github-actions/ci.py`]: https://github.com/rust-lang/rust/blob/master/src/ci/github-actions/ci.py
454+
[`src/ci/citool`]: https://github.com/rust-lang/rust/blob/master/src/ci/citool
447455
[rust-lang-ci]: https://github.com/rust-lang-ci/rust/actions
448456
[bors]: https://github.com/bors
449457
[homu]: https://github.com/rust-lang/homu

Diff for: src/tests/compiletest.md

+4-28
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ The following test suites are available, with links for more information:
7474

7575
### General purpose test suite
7676

77-
[`run-make`](#run-make-tests) are general purpose tests using Rust programs (or
78-
Makefiles (legacy)).
77+
[`run-make`](#run-make-tests) are general purpose tests using Rust programs.
7978

8079
### Rustdoc test suites
8180

@@ -396,14 +395,6 @@ your test, causing separate files to be generated for 32bit and 64bit systems.
396395

397396
### `run-make` tests
398397

399-
> **Note on phasing out `Makefile`s**
400-
>
401-
> We are planning to migrate all existing Makefile-based `run-make` tests
402-
> to Rust programs. You should not be adding new Makefile-based `run-make`
403-
> tests.
404-
>
405-
> See <https://github.com/rust-lang/rust/issues/121876>.
406-
407398
The tests in [`tests/run-make`] are general-purpose tests using Rust *recipes*,
408399
which are small programs (`rmake.rs`) allowing arbitrary Rust code such as
409400
`rustc` invocations, and is supported by a [`run_make_support`] library. Using
@@ -424,10 +415,9 @@ Compiletest directives like `//@ only-<target>` or `//@ ignore-<target>` are
424415
supported in `rmake.rs`, like in UI tests. However, revisions or building
425416
auxiliary via directives are not currently supported.
426417

427-
Two `run-make` tests are ported over to Rust recipes as examples:
428-
429-
- <https://github.com/rust-lang/rust/tree/master/tests/run-make/CURRENT_RUSTC_VERSION>
430-
- <https://github.com/rust-lang/rust/tree/master/tests/run-make/a-b-a-linker-guard>
418+
`rmake.rs` and `run-make-support` may *not* use any nightly/unstable features,
419+
as they must be compilable by a stage 0 rustc that may be a beta or even stable
420+
rustc.
431421

432422
#### Quickly check if `rmake.rs` tests can be compiled
433423

@@ -481,20 +471,6 @@ Then add a corresponding entry to `"rust-analyzer.linkedProjects"`
481471
],
482472
```
483473

484-
#### Using Makefiles (legacy)
485-
486-
<div class="warning">
487-
You should avoid writing new Makefile-based `run-make` tests.
488-
</div>
489-
490-
Each test should be in a separate directory with a `Makefile` indicating the
491-
commands to run.
492-
493-
There is a [`tools.mk`] Makefile which you can include which provides a bunch of
494-
utilities to make it easier to run commands and compare outputs. Take a look at
495-
some of the other tests for some examples on how to get started.
496-
497-
[`tools.mk`]: https://github.com/rust-lang/rust/blob/master/tests/run-make/tools.mk
498474
[`tests/run-make`]: https://github.com/rust-lang/rust/tree/master/tests/run-make
499475
[`run_make_support`]: https://github.com/rust-lang/rust/tree/master/src/tools/run-make-support
500476

Diff for: src/tests/directives.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
FIXME(jieyouxu) completely revise this chapter.
77
-->
88

9-
Directives are special comments that tell compiletest how to build and interpret
10-
a test. They must appear before the Rust source in the test. They may also
11-
appear in `rmake.rs` or legacy Makefiles for [run-make
12-
tests](compiletest.md#run-make-tests).
9+
Directives are special comments that tell compiletest how to build and interpret a test. They must appear before the Rust source in the test. They may also appear in `rmake.rs` [run-make tests](compiletest.md#run-make-tests).
1310

1411
They are normally put after the short comment that explains the point of this
1512
test. Compiletest test suites use `//@` to signal that a comment is a directive.
@@ -142,6 +139,7 @@ Some examples of `X` in `ignore-X` or `only-X`:
142139
- Pointer width: `32bit`, `64bit`
143140
- Endianness: `endian-big`
144141
- Stage: `stage1`, `stage2`
142+
- Binary format: `elf`
145143
- Channel: `stable`, `beta`
146144
- When cross compiling: `cross-compile`
147145
- When [remote testing] is used: `remote`
@@ -220,8 +218,6 @@ The following directives will check LLVM support:
220218
[`aarch64-gnu-debug`]), which only runs a
221219
subset of `run-make` tests. Other tests with this directive will not
222220
run at all, which is usually not what you want.
223-
- Notably, the [`aarch64-gnu-debug`] CI job *currently* only runs `run-make`
224-
tests which additionally contain `clang` in their test name.
225221

226222
See also [Debuginfo tests](compiletest.md#debuginfo-tests) for directives for
227223
ignoring debuggers.

Diff for: src/tests/docker.md

+9
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ Some additional notes about using the interactive mode:
5353
containers. With the container name, run `docker exec -it <CONTAINER>
5454
/bin/bash` where `<CONTAINER>` is the container name like `4ba195e95cef`.
5555

56+
The approach described above is a relatively low-level interface for running the Docker images
57+
directly. If you want to run a full CI Linux job locally with Docker, in a way that is as close to CI as possible, you can use the following command:
58+
59+
```bash
60+
cargo run --manifest-path src/ci/citool/Cargo.toml run-local <job-name>
61+
# For example:
62+
cargo run --manifest-path src/ci/citool/Cargo.toml run-local dist-x86_64-linux-alt
63+
```
64+
5665
[Docker]: https://www.docker.com/
5766
[`src/ci/docker`]: https://github.com/rust-lang/rust/tree/master/src/ci/docker
5867
[`src/ci/docker/run.sh`]: https://github.com/rust-lang/rust/blob/master/src/ci/docker/run.sh

Diff for: src/tests/running.md

-25
Original file line numberDiff line numberDiff line change
@@ -240,30 +240,6 @@ This is much faster, but doesn't always work. For example, some tests include
240240
directives that specify specific compiler flags, or which rely on other crates,
241241
and they may not run the same without those options.
242242

243-
## Running `run-make` tests
244-
245-
### Windows
246-
247-
Running the `run-make` test suite on Windows is a currently bit more involved.
248-
There are numerous prerequisites and environmental requirements:
249-
250-
- Install msys2: <https://www.msys2.org/>
251-
- Specify `MSYS2_PATH_TYPE=inherit` in `msys2.ini` in the msys2 installation directory, run the
252-
following with `MSYS2 MSYS`:
253-
- `pacman -Syuu`
254-
- `pacman -S make`
255-
- `pacman -S diffutils`
256-
- `pacman -S binutils`
257-
- `./x test run-make` (`./x test tests/run-make` doesn't work)
258-
259-
There is [on-going work][port-run-make] to not rely on `Makefile`s in the
260-
run-make test suite. Once this work is completed, you can run the entire
261-
`run-make` test suite on native Windows inside `cmd` or `PowerShell` without
262-
needing to install and use MSYS2. As of <!--date-check --> Oct 2024, it is
263-
already possible to run the vast majority of the `run-make` test suite outside
264-
of MSYS2, but there will be failures for the tests that still use `Makefile`s
265-
due to not finding `make`.
266-
267243
## Running tests on a remote machine
268244

269245
Tests may be run on a remote machine (e.g. to test builds for a different
@@ -408,4 +384,3 @@ If you encounter bugs or problems, don't hesitate to open issues on the
408384
repository](https://github.com/rust-lang/rustc_codegen_gcc/).
409385

410386
[`tests/ui`]: https://github.com/rust-lang/rust/tree/master/tests/ui
411-
[port-run-make]: https://github.com/rust-lang/rust/issues/121876

0 commit comments

Comments
 (0)