Skip to content

rustc pull #2215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 40 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
280d738
Update rustc-dev-guide
Kobzol Jan 7, 2025
1760a3d
Merge from rustc
RalfJung Jan 8, 2025
4498820
Merge pull request #4127 from rust-lang/rustup-2025-01-08
RalfJung Jan 8, 2025
68734d1
Rollup merge of #134898 - Kobzol:ci-python-script, r=MarcoIeni
matthiaskrgr Jan 9, 2025
d35f2db
Rollup merge of #135195 - oli-obk:push-toyoyrupruko, r=lcnr
matthiaskrgr Jan 9, 2025
68fc700
Rollup merge of #135261 - compiler-errors:coverage-has-identity-subst…
matthiaskrgr Jan 9, 2025
0198345
Auto merge of #135286 - matthiaskrgr:rollup-sxuq1nh, r=matthiaskrgr
bors Jan 9, 2025
98c8461
Auto merge of #135297 - flip1995:clippy-subtree-update, r=matthiaskrgr
bors Jan 10, 2025
4005278
Auto merge of #135273 - dianne:argument-patterns-are-not-boring, r=lqd
bors Jan 10, 2025
1e743f3
Auto merge of #135274 - saethlin:array-repeats, r=compiler-errors
bors Jan 11, 2025
9ccfdd1
Auto merge of #135292 - lqd:rustcperfup, r=kobzol
bors Jan 11, 2025
eecd68c
rustc-dev-guide: update outdated LLVM stamp filename
onur-ozkan Jan 12, 2025
d86805f
Auto merge of #135281 - onur-ozkan:build-stamps, r=jieyouxu
bors Jan 12, 2025
84410f2
Auto merge of #135384 - saethlin:inline-copy-from-slice, r=joboet
bors Jan 12, 2025
4d4084c
Auto merge of #135371 - Mark-Simulacrum:no-alloc-case-cmp, r=compiler…
bors Jan 13, 2025
3a3512d
Auto merge of #135352 - notriddle:notriddle/stability-shown, r=camelid
bors Jan 13, 2025
a58b85a
rustc-dev-guide: document `BOOTSTRAP_TRACING` and bootstrap `tracing`…
jieyouxu Jan 12, 2025
5ff1029
Rollup merge of #135355 - ranger-ross:improved-ci-logs, r=onur-ozkan
jhpratt Jan 13, 2025
6dd2245
Rollup merge of #135386 - lolbinarycat:bootstrap-test-cleanup, r=jiey…
jhpratt Jan 13, 2025
94e1724
Rollup merge of #135391 - jieyouxu:conditional-tracing, r=onur-ozkan
jhpratt Jan 13, 2025
a511ad5
Auto merge of #135430 - jhpratt:rollup-39cecwd, r=jhpratt
bors Jan 13, 2025
355f17e
Auto merge of #135167 - mzacho:depth-limit-const-eval-query, r=oli-obk
bors Jan 13, 2025
b339d5c
Auto merge of #135204 - RalfJung:win64-zst, r=SparrowLii
bors Jan 13, 2025
9b47452
Auto merge of #135192 - jdupak-ms:cdb-tests, r=wesleywiser
bors Jan 13, 2025
92984b2
Auto merge of #135359 - RalfJung:lang-start-unwind, r=joboet
bors Jan 14, 2025
c2895e2
Auto merge of #135278 - tgross35:ignore-std-dep-crates, r=SparrowLii
bors Jan 14, 2025
75c3d2b
Auto merge of #135313 - compiler-errors:needs-mono, r=BoxyUwU
bors Jan 14, 2025
5f01316
Auto merge of #135385 - rust-lang:cargo_update, r=clubby789
bors Jan 15, 2025
920eac0
Merge from rustc
Jan 15, 2025
dd8c7d7
Merge pull request #4139 from rust-lang/rustup-2025-01-15
RalfJung Jan 15, 2025
728805d
Auto merge of #134504 - oli-obk:push-rltsvnyttwll, r=compiler-errors
bors Jan 16, 2025
66eb7ef
Auto merge of #135047 - Flakebi:amdgpu-kernel-cc, r=workingjubilee
bors Jan 17, 2025
101f539
Auto merge of #135329 - oli-obk:push-sytltwnzxlrq, r=Noratrieb
bors Jan 17, 2025
166fa3b
Fix dev guide docs for error-pattern
Noratrieb Jan 19, 2025
ab001eb
Rollup merge of #135723 - Noratrieb:error-pattern-my-a-, r=jieyouxu
GuillaumeGomez Jan 19, 2025
ed17390
Auto merge of #135725 - GuillaumeGomez:rollup-dxn3use, r=GuillaumeGomez
bors Jan 19, 2025
e0621e4
Auto merge of #135714 - rust-lang:cargo_update, r=clubby789
bors Jan 19, 2025
9ee223d
Auto merge of #135742 - RalfJung:miri-sync, r=RalfJung
bors Jan 19, 2025
c89935f
Preparing for merge from rustc
Kobzol Jan 20, 2025
1e32114
Merge from rustc
Kobzol Jan 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9c87288a7d2f03625a813df6d3bfe43c09ad4f5a
ecda83b30f0f68cf5692855dddc0bc38ee8863fc
1 change: 1 addition & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
- [Prologue](./building/bootstrapping/intro.md)
- [What Bootstrapping does](./building/bootstrapping/what-bootstrapping-does.md)
- [How Bootstrap does it](./building/bootstrapping/how-bootstrap-does-it.md)
- [Debugging bootstrap](./building/bootstrapping/debugging-bootstrap.md)

# High-level Compiler Architecture

Expand Down
2 changes: 1 addition & 1 deletion src/backend/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ These tools include:

By default, the Rust build system does not check for changes to the LLVM source code or
its build configuration settings. So, if you need to rebuild the LLVM that is linked
into `rustc`, first delete the file `llvm-finished-building`, which should be located
into `rustc`, first delete the file `.llvm-stamp`, which should be located
in `build/<host-triple>/llvm/`.

The default rustc compilation pipeline has multiple codegen units, which is
Expand Down
100 changes: 100 additions & 0 deletions src/building/bootstrapping/debugging-bootstrap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Debugging bootstrap

> FIXME: this page could be expanded

## `tracing` in bootstrap

Bootstrap has conditional [`tracing`][tracing] setup to provide structured logging.

[tracing]: https://docs.rs/tracing/0.1.41/tracing/index.html

### Enabling `tracing` output

Bootstrap will conditionally enable `tracing` output if the `BOOTSTRAP_TRACING` env var is set.

Example usage:

```bash
$ BOOTSTRAP_TRACING=TRACE ./x build library --stage 1
```

Example output[^experimental]:

![Example bootstrap tracing output](./debugging-bootstrap/tracing-output-example.png)

[^experimental]: This shows what's *possible* with the infra in an experimental implementation.

The env var `BOOTSTRAP_TRACING` accepts a [`tracing` env-filter][tracing-env-filter]. The `TRACE` filter will enable *all* `trace` level or less verbose level tracing output.

[tracing-env-filter]: https://docs.rs/tracing-subscriber/0.3.19/tracing_subscriber/filter/struct.EnvFilter.html

### Using `tracing` in bootstrap

Both `tracing::*` macros and the `tracing::instrument` proc-macro attribute need to be gated behind `tracing` feature. Examples:

```rs
#[cfg(feature = "tracing")]
use tracing::{instrument, trace};

struct Foo;

impl Step for Foo {
type Output = ();

#[cfg_attr(feature = "tracing", instrument(level = "trace", name = "Foo::should_run", skip_all))]
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
#[cfg(feature = "tracing")]
trace!(?run, "entered Foo::should_run");

todo!()
}

#[cfg_attr(
feature = "tracing",
instrument(
level = "trace",
name = "Foo::run",
skip_all,
fields(compiler = ?builder.compiler),
),
)]
fn run(self, builder: &Builder<'_>) -> Self::Output {
#[cfg(feature = "tracing")]
trace!(?run, "entered Foo::run");

todo!()
}
}
```

For `#[instrument]`, it's recommended to:

- Gate it behind `trace` level for fine-granularity, possibly `debug` level for core functions.
- Explicitly pick an instrumentation name via `name = ".."` to distinguish between e.g. `run` of different steps.
- Take care to not cause diverging behavior via tracing, e.g. building extra things only when tracing infra is enabled.

### Enabling `tracing` bootstrap feature in rust-analyzer

You can adjust your `settings.json`'s `rust-analyzer.check.overrideCommand` and `rust-analyzer.cargo.buildScripts.overrideCommand` if you want to also enable `logging` cargo feature by default in your editor. This is mostly useful if you want proper r-a completions and such when working on bootstrap itself.

```json
"rust-analyzer.check.overrideCommand": [
"BOOTSTRAP_TRACING=1", // <- BOOTSTRAP_TRACING=1 won't enable tracing filter, but it will activate bootstrap's `tracing` feature
"python3",
"x.py",
"check",
"--json-output",
"--build-dir=build-rust-analyzer"
],
```

```json
"rust-analyzer.cargo.buildScripts.overrideCommand": [
"BOOTSTRAP_TRACING=1", // <- note this
"python3",
"x.py",
"check",
"--json-output",
"--build-dir=build-rust-analyzer"
],
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/building/bootstrapping/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ In this section, we give a high-level overview of
[what Bootstrap does](./what-bootstrapping-does.md), followed by a high-level
introduction to [how Bootstrap does it](./how-bootstrap-does-it.md).

Additionally, see [debugging bootstrap](./debugging-bootstrap.md) to learn
about debugging methods.

[boot]: https://en.wikipedia.org/wiki/Bootstrapping_(compilers)
[ocaml-compiler]: https://github.com/rust-lang/rust/tree/ef75860a0a72f79f97216f8aaa5b388d98da6480/src/boot
2 changes: 1 addition & 1 deletion src/building/optimized-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ Here is an example of how can `opt-dist` be used locally (outside of CI):
[`Environment`]: https://github.com/rust-lang/rust/blob/ee451f8faccf3050c76cdcd82543c917b40c7962/src/tools/opt-dist/src/environment.rs#L5

> Note: if you want to run the actual CI pipeline, instead of running `opt-dist` locally,
> you can execute `DEPLOY=1 src/ci/docker/run.sh dist-x86_64-linux`.
> you can execute `python3 src/ci/github-actions/ci.py run-local dist-x86_64-linux`.
3 changes: 1 addition & 2 deletions src/tests/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ platform’s custom [Docker container]. This has a lot of advantages for us:
- We can avoid reinstalling tools (like QEMU or the Android emulator) every time
thanks to Docker image caching.
- Users can run the same tests in the same environment locally by just running
`src/ci/docker/run.sh image-name`, which is awesome to debug failures. Note
that there are only linux docker images available locally due to licensing and
`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
other restrictions.

The docker images prefixed with `dist-` are used for building artifacts while
Expand Down
3 changes: 2 additions & 1 deletion src/tests/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ for more details.
| Directive | Explanation | Supported test suites | Possible values |
|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------|----------------------------------------------|-----------------------------------------------------------------------------------------|
| `check-run-results` | Check run test binary `run-{pass,fail}` output snapshot | `ui`, `crashes`, `incremental` if `run-pass` | N/A |
| `error-pattern` | Check that output contains a regex pattern | `ui`, `crashes`, `incremental` if `run-pass` | Regex |
| `error-pattern` | Check that output contains a specific string | `ui`, `crashes`, `incremental` if `run-pass` | String |
| `regex-error-pattern` | Check that output contains a regex pattern | `ui`, `crashes`, `incremental` if `run-pass` | Regex |
| `check-stdout` | Check `stdout` against `error-pattern`s from running test binary[^check_stdout] | `ui`, `crashes`, `incremental` | N/A |
| `normalize-stderr-32bit` | Normalize actual stderr (for 32-bit platforms) with a rule `"<raw>" -> "<normalized>"` before comparing against snapshot | `ui`, `incremental` | `"<RAW>" -> "<NORMALIZED>"`, `<RAW>`/`<NORMALIZED>` is regex capture and replace syntax |
| `normalize-stderr-64bit` | Normalize actual stderr (for 64-bit platforms) with a rule `"<raw>" -> "<normalized>"` before comparing against snapshot | `ui`, `incremental` | `"<RAW>" -> "<NORMALIZED>"`, `<RAW>`/`<NORMALIZED>` is regex capture and replace syntax |
Expand Down
9 changes: 9 additions & 0 deletions src/tests/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ Some additional notes about using the Docker images:
containers. With the container name, run `docker exec -it <CONTAINER>
/bin/bash` where `<CONTAINER>` is the container name like `4ba195e95cef`.

The approach described above is a relatively low-level interface for running the Docker images
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:

```bash
python3 src/ci/github-actions/ci.py run-local <job-name>
# For example:
python3 src/ci/github-actions/ci.py run-local dist-x86_64-linux-alt
```

[Docker]: https://www.docker.com/
[`src/ci/docker`]: https://github.com/rust-lang/rust/tree/master/src/ci/docker
[`src/ci/docker/run.sh`]: https://github.com/rust-lang/rust/blob/master/src/ci/docker/run.sh
Expand Down
Loading