Skip to content

Commit e3ec867

Browse files
authored
Rollup merge of #156337 - tshepang:rdg-sync, r=tshepang
rustc-dev-guide subtree update Subtree update of `rustc-dev-guide` to 34d6968. Created using https://github.com/rust-lang/josh-sync. r? @ghost
2 parents 19ee113 + 34d6968 commit e3ec867

9 files changed

Lines changed: 60 additions & 44 deletions

File tree

ci/sembr/src/main.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,16 @@ fn main() -> Result<()> {
4545
continue;
4646
}
4747
let old = fs::read_to_string(&path)?;
48-
let new = lengthen_lines(&comply(&old), cli.line_length_limit);
48+
let new = comply(&old);
4949
if new == old {
5050
compliant.push(path.clone());
51-
} else if cli.overwrite {
52-
fs::write(&path, new)?;
53-
made_compliant.push(path.clone());
5451
} else {
55-
not_compliant.push(path.clone());
52+
if cli.overwrite {
53+
fs::write(&path, lengthen_lines(&new, cli.line_length_limit))?;
54+
made_compliant.push(path.clone());
55+
} else {
56+
not_compliant.push(path.clone());
57+
}
5658
}
5759
}
5860
}

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f53b654a8882fd5fc036c4ca7a4ff41ce32497a6
1+
f2b291d902bfde7d7f209fc3a64908134bcef201

src/autodiff/installation.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ For the meantime, you can download up-to-date builds to enable `std::autodiff` o
66
**Linux**, with `x86_64-unknown-linux-gnu` or `aarch64-unknown-linux-gnu`
77
**Windows**, with `x86_64-llvm-mingw` or `aarch64-llvm-mingw`
88

9-
You can also download slightly outdated builds for **Apple** (aarch64-apple), which should generally work for now.
9+
In the past you could also download builds for **Apple** (aarch64-apple), however they are not usable at the moment.
1010

1111
If you need any other platform, you can build rustc including autodiff from source.
1212
Please open an issue if you want to help enabling automatic builds for your prefered target.
@@ -24,7 +24,7 @@ For now, you'll have to manually download and copy it.
2424
5) Copy the artifact (libEnzyme-22.so for linux, libEnzyme-22.dylib for apple, etc.), which should be in a folder named `enzyme-preview`, to your rust toolchain directory. E.g. for linux: `cp ~/Downloads/enzyme-nightly-x86_64-unknown-linux-gnu/enzyme-preview/lib/rustlib/x86_64-unknown-linux-gnu/lib/libEnzyme-22.so ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib`
2525

2626
Apple support was temporarily reverted, due to downstream breakages.
27-
If you want to download autodiff for apple, please look at the artifacts from this [`run`].
27+
Please (currently) build it from source.
2828

2929
## Installation guide for Nix user.
3030

@@ -111,8 +111,7 @@ docker cp <dockerid>:/rust/build/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.
111111
Afterwards we can create a new (pre-release) tag on the EnzymeAD/rust repository and make a PR against the EnzymeAD/enzyme-explorer repository to update the tag.
112112
Remember to ping `tgymnich` on the PR to run his update script.
113113
Note: We should archive EnzymeAD/rust and update the instructions here.
114-
The explorer should soon
115-
be able to get the rustc toolchain from the official rust servers.
114+
The explorer should soon be able to get the rustc toolchain from the official rust servers.
116115

117116

118117
## Build instruction for Enzyme itself
@@ -144,5 +143,4 @@ This will build Enzyme, and you can find it in `Enzyme/enzyme/build/lib/<LLD/Cla
144143
(Endings might differ based on your OS).
145144

146145
[`Repo`]: https://github.com/rust-lang/rust/
147-
[`run`]: https://github.com/rust-lang/rust/pull/153026#issuecomment-3950046599
148146
[`Overlay`]: https://github.com/oxalica/rust-overlay

src/building/build-install-distribution-artifacts.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
You might want to build and package up the compiler for distribution.
44
You’ll want to run this command to do it:
55

6-
```bash
6+
```console
77
./x dist
88
```
99

1010
# Install from source
1111

1212
You might want to prefer installing Rust (and tools configured in your configuration)
13-
by building from source. If so, you want to run this command:
13+
by building from source.
14+
If so, you want to run this command:
1415

15-
```bash
16+
```console
1617
./x install
1718
```
1819

@@ -24,8 +25,9 @@ by building from source. If so, you want to run this command:
2425
invoke it with `rustc +foo ...` (where ... represents the rest of the arguments).
2526

2627
Instead of installing Rust (and tools in your config file) globally, you can set `DESTDIR`
27-
environment variable to change the installation path. If you want to set installation paths
28+
environment variable to change the installation path.
29+
If you want to set installation paths
2830
more dynamically, you should prefer [install options] in your config file to achieve that.
2931

3032
[create-rustup-toolchain]: ./how-to-build-and-run.md#creating-a-rustup-toolchain
31-
[install options]: https://github.com/rust-lang/rust/blob/f7c8928f035370be33463bb7f1cd1aeca2c5f898/config.example.toml#L422-L442
33+
[install options]: https://github.com/rust-lang/rust/blob/f7c8928f035370be33463bb7f1cd1aeca2c5f898/config.example.toml#L422-L442

src/implementing-new-features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ The below steps needs to be followed in order to implement a new unstable featur
197197
For features introducing new syntax, pre-expansion gating should be used instead.
198198
During parsing, when the new syntax is parsed,
199199
the symbol must be inserted to the current crate's [`GatedSpans`]
200-
via `self.sess.gated_span.gate(sym::my_feature, span)`.
200+
via `self.psess.gated_spans.gate(sym::my_feature, span)`.
201201

202202
After being inserted to the gated spans,
203203
the span must be checked in the [`rustc_ast_passes::feature_gate::check_crate`] function,

src/offload/installation.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@ This gives you a working LLVM build.
3939

4040

4141
## Testing
42-
run
42+
Run this test script for offload-specific tests:
4343
```console
4444
./x test --stage 1 tests/codegen-llvm/gpu_offload
4545
```
46+
47+
For testing the CI locally, you may use the commands outlined in [Testing with Docker](https://rustc-dev-guide.rust-lang.org/tests/docker.html):
48+
```console
49+
cargo run --manifest-path src/ci/citool/Cargo.toml run-local dist-x86_64-linux
50+
```
51+
This stores all compiler artifacts in the `obj` directory, however should you modify rustc-specific code, you may need to delete this directory as the Docker image will cache its state otherwise.
52+
53+
Submodules should also be checked out at this point.

src/tests/compiletest.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -832,13 +832,14 @@ check for any problems that might arise.
832832
To run the tests in a different mode, you need to pass the `--compare-mode` CLI flag:
833833

834834
```bash
835-
./x test tests/ui --compare-mode=chalk
835+
./x test tests/ui --compare-mode=next-solver
836836
```
837837

838838
The possible compare modes are:
839839

840-
- `polonius` — Runs with Polonius with `-Zpolonius`.
841-
- `chalk` — Runs with Chalk with `-Zchalk`.
840+
- `polonius` — Runs with Polonius with `-Zpolonius=next`.
841+
- `next-solver` — Runs with the next trait solver with `-Znext-solver`.
842+
- `next-solver-coherence` — Runs coherence with the next trait solver with `-Znext-solver=coherence`.
842843
- `split-dwarf` — Runs with unpacked split-DWARF with `-Csplit-debuginfo=unpacked`.
843844
- `split-dwarf-single` — Runs with packed split-DWARF with `-Csplit-debuginfo=packed`.
844845

src/tests/directives.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ Some examples of `X` in `ignore-X` or `only-X`:
148148
- When particular debuggers are being tested: `cdb`, `gdb`, `lldb`
149149
- When particular debugger versions are matched: `ignore-gdb-version`
150150
- When the [parallel frontend] is enabled: `ignore-parallel-frontend`
151-
- Specific [compare modes]: `compare-mode-polonius`, `compare-mode-chalk`,
151+
- Specific [compare modes]: `compare-mode-polonius`,
152+
`compare-mode-next-solver`, `compare-mode-next-solver-coherence`,
152153
`compare-mode-split-dwarf`, `compare-mode-split-dwarf-single`
153154
- The two different test modes used by coverage tests:
154155
`ignore-coverage-map`, `ignore-coverage-run`

src/unsafety-checking.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,50 @@
11
# Unsafety checking
22

33
Certain expressions in Rust can violate memory safety and as such need to be
4-
inside an `unsafe` block or function. The compiler will also warn if an unsafe
5-
block is used without any corresponding unsafe operations.
4+
inside an `unsafe` block or function.
5+
The compiler will also warn if an unsafe block is used without any corresponding unsafe operations.
66

77
## Overview
88

9-
The unsafety check is located in the [`check_unsafety`] module. It performs a
10-
walk over the [THIR] of a function and all of its closures and inline constants.
9+
The unsafety check is located in the [`check_unsafety`] module.
10+
It performs a walk over the [THIR] of a function and all of its closures and inline constants.
1111
It keeps track of the unsafe context: whether it has entered an `unsafe` block.
12-
If an unsafe operation is used outside of an `unsafe` block, then an error is
13-
reported. If an unsafe operation is used in an unsafe block then that block is
14-
marked as used for [the unused_unsafe lint](#the-unused_unsafe-lint).
12+
If an unsafe operation is used outside of an `unsafe` block, then an error is reported.
13+
If an unsafe operation is used in an unsafe block,
14+
that block is marked as used for [the unused_unsafe lint](#the-unused_unsafe-lint).
1515

16-
The unsafety check needs type information so could potentially be done on the
17-
HIR, making use of typeck results, THIR or MIR. THIR is chosen because there are
16+
The unsafety check needs type information, so could potentially be done on the
17+
HIR, making use of typeck results, THIR or MIR.
18+
THIR is chosen because there are
1819
fewer cases to consider than in HIR, for example unsafe function calls and
19-
unsafe method calls have the same representation in THIR. The check is not done
20-
on MIR because safety checks do not depend on control flow so MIR is not
21-
necessary to use and MIR doesn't have as precise spans for some expressions.
20+
unsafe method calls have the same representation in THIR.
21+
The check is not done on MIR because safety checks do not depend on control flow,
22+
so there is no need to use MIR.
23+
Also, MIR doesn't have precise enough spans for some expressions.
2224

2325
Most unsafe operations can be identified by checking the `ExprKind` in THIR and
24-
checking the type of the argument. For example, dereferences of a raw pointer
26+
checking the type of the argument.
27+
For example, dereferences of a raw pointer
2528
correspond to `ExprKind::Deref`s with an argument that has a raw pointer type.
2629

2730
Looking for unsafe Union field accesses is a bit more complex because writing to
28-
a field of a union is safe. The checker tracks when it's visiting the left-hand
31+
a field of a union is safe.
32+
The checker tracks when it's visiting the left-hand
2933
side of an assignment expression and allows union fields to directly appear
30-
there, while erroring in all other cases. Union field accesses can also occur
31-
in patterns, so those have to be walked as well.
34+
there, while erroring in all other cases.
35+
Union field accesses can also occur in patterns, so those have to be walked as well.
3236

3337
[THIR]: ./thir.md
3438
[`check_unsafety`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/check_unsafety/index.html
3539

3640
## The unused_unsafe lint
3741

38-
The unused_unsafe lint reports `unsafe` blocks that can be removed. The unsafety
39-
checker records whenever it finds an operation that requires unsafe. The lint is
40-
then reported if either:
42+
The unused_unsafe lint reports `unsafe` blocks that can be removed.
43+
The unsafety checker records whenever it finds an operation that requires unsafe.
44+
The lint is then reported if either:
4145

4246
- An `unsafe` block contains no unsafe operations
43-
- An `unsafe` block is within another unsafe block, and the outer block
44-
isn't considered unused
47+
- An `unsafe` block is within another unsafe block, and the outer block isn't considered unused
4548

4649
```rust
4750
#![deny(unused_unsafe)]
@@ -64,7 +67,8 @@ unsafe {
6467
## Other checks involving `unsafe`
6568

6669
[Unsafe traits] require an `unsafe impl` to be implemented, the check for this
67-
is done as part of [coherence]. The `unsafe_code` lint is run as a lint pass on
70+
is done as part of [coherence].
71+
The `unsafe_code` lint is run as a lint pass on
6872
the ast that searches for unsafe blocks, functions and implementations, as well
6973
as certain unsafe attributes.
7074

0 commit comments

Comments
 (0)