Skip to content

Commit ad9210d

Browse files
authored
Merge pull request #1853 from Kobzol/pull-fixed
Perform the first rustc pull.. for the second time
2 parents 6e38c02 + 53023ae commit ad9210d

File tree

11 files changed

+89
-22
lines changed

11 files changed

+89
-22
lines changed

josh-sync.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
org = "rust-lang"
2+
repo = "rustc-dev-guide"
3+
path = "src/doc/rustc-dev-guide"

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d1d8e386c5e84c4ba857f56c3291f73c27e2d62a
1+
c96a69059ecc618b519da385a6ccd03155aa0237

src/autodiff/internals.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ The `std::autodiff` module in Rust allows differentiable programming:
22

33
```rust
44
#![feature(autodiff)]
5-
use std::autodiff::autodiff;
5+
use std::autodiff::*;
66

77
// f(x) = x * x, f'(x) = 2.0 * x
88
// bar therefore returns (x * x, 2.0 * x)
9-
#[autodiff(bar, Reverse, Active, Active)]
9+
#[autodiff_reverse(bar, Active, Active)]
1010
fn foo(x: f32) -> f32 { x * x }
1111

1212
fn main() {

src/building/how-to-build-and-run.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
<!-- toc -->
44

5+
<div class="warning">
6+
7+
For `profile = "library"` users, or users who use `download-rustc = true | "if-unchanged"`, please be advised that
8+
the `./x test library/std` flow where `download-rustc` is active (i.e. no compiler changes) is currently broken.
9+
This is tracked in <https://github.com/rust-lang/rust/issues/142505>. Only the `./x test` flow is affected in this
10+
case, `./x {check,build} library/std` should still work.
11+
12+
In the short-term, you may need to disable `download-rustc` for `./x test library/std`. This can be done either by:
13+
14+
1. `./x test library/std --set rust.download-rustc=false`
15+
2. Or set `rust.download-rustc=false` in `bootstrap.toml`.
16+
17+
Unfortunately that will require building the stage 1 compiler. The bootstrap team is working on this, but
18+
implementing a maintainable fix is taking some time.
19+
20+
</div>
21+
22+
523
The compiler is built using a tool called `x.py`. You will need to
624
have Python installed to run it.
725

src/contributing.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,10 @@ Just a few things to keep in mind:
434434
it might benefit from having a Table of Contents at the beginning,
435435
which you can auto-generate by including the `<!-- toc -->` marker at the top.
436436

437+
#### ⚠️ Note: Where to contribute `rustc-dev-guide` changes
438+
439+
For detailed information about where to contribute rustc-dev-guide changes and the benefits of doing so, see [the rustc-dev-guide working group documentation](https://forge.rust-lang.org/wg-rustc-dev-guide/index.html#where-to-contribute-rustc-dev-guide-changes).
440+
437441
## Issue triage
438442

439443
Please see <https://forge.rust-lang.org/release/issue-triaging.html>.

src/diagnostics/diagnostic-structs.md

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# Diagnostic and subdiagnostic structs
22
rustc has three diagnostic traits that can be used to create diagnostics:
3-
`Diagnostic`, `LintDiagnostic`, and `Subdiagnostic`. For simple diagnostics,
4-
instead of using the `Diag` API to create and emit diagnostics,
5-
derived impls can be used. They are only suitable for simple diagnostics that
3+
`Diagnostic`, `LintDiagnostic`, and `Subdiagnostic`.
4+
5+
For simple diagnostics,
6+
derived impls can be used, e.g. `#[derive(Diagnostic)]`. They are only suitable for simple diagnostics that
67
don't require much logic in deciding whether or not to add additional
78
subdiagnostics.
89

9-
Such diagnostic can be translated into
10-
different languages and each has a slug that uniquely identifies the
11-
diagnostic.
10+
In cases where diagnostics require more complex or dynamic behavior, such as conditionally adding subdiagnostics,
11+
customizing the rendering logic, or selecting messages at runtime, you will need to manually implement
12+
the corresponding trait (`Diagnostic`, `LintDiagnostic`, or `Subdiagnostic`).
13+
This approach provides greater flexibility and is recommended for diagnostics that go beyond simple, static structures.
14+
15+
Diagnostic can be translated into different languages and each has a slug that uniquely identifies the diagnostic.
1216

1317
## `#[derive(Diagnostic)]` and `#[derive(LintDiagnostic)]`
1418

@@ -142,7 +146,7 @@ tcx.dcx().emit_err(FieldAlreadyDeclared {
142146
});
143147
```
144148

145-
### Reference
149+
### Reference for `#[derive(Diagnostic)]` and `#[derive(LintDiagnostic)]`
146150
`#[derive(Diagnostic)]` and `#[derive(LintDiagnostic)]` support the
147151
following attributes:
148152

@@ -330,7 +334,34 @@ function ([example][subdiag_use_1] and [example][subdiag_use_2]) on a
330334
diagnostic or by assigning it to a `#[subdiagnostic]`-annotated field of a
331335
diagnostic struct.
332336

333-
### Reference
337+
### Argument sharing and isolation
338+
339+
Subdiagnostics add their own arguments (i.e., certain fields in their structure) to the `Diag` structure before rendering the information.
340+
`Diag` structure also stores the arguments from the main diagnostic, so the subdiagnostic can also use the arguments from the main diagnostic.
341+
342+
However, when a subdiagnostic is added to a main diagnostic by implementing `#[derive(Subdiagnostic)]`,
343+
the following rules, introduced in [rust-lang/rust#142724](https://github.com/rust-lang/rust/pull/142724)
344+
apply to the handling of arguments (i.e., variables used in Fluent messages):
345+
346+
**Argument isolation between sub diagnostics**:
347+
Arguments set by a subdiagnostic are only available during the rendering of that subdiagnostic.
348+
After the subdiagnostic is rendered, all arguments it introduced are restored from the main diagnostic.
349+
This ensures that multiple subdiagnostics do not pollute each other's argument scope.
350+
For example, when using a `Vec<Subdiag>`, it iteratively adds the same argument over and over again.
351+
352+
**Same argument override between sub and main diagnostics**:
353+
If a subdiagnostic sets a argument with the same name as a arguments already in the main diagnostic,
354+
it will report an error at runtime unless both have exactly the same value.
355+
It has two benefits:
356+
- preserves the flexibility that arguments in the main diagnostic are allowed to appear in the attributes of the subdiagnostic.
357+
For example, There is an attribute `#[suggestion(code = "{new_vis}")]` in the subdiagnostic, but `new_vis` is the field in the main diagnostic struct.
358+
- prevents accidental overwriting or deletion of arguments required by the main diagnostic or other subdiagnostics.
359+
360+
These rules guarantee that arguments injected by subdiagnostics are strictly scoped to their own rendering.
361+
The main diagnostic's arguments remain unaffected by subdiagnostic logic, even in the presence of name collisions.
362+
Additionally, subdiagnostics can access arguments from the main diagnostic with the same name when needed.
363+
364+
### Reference for `#[derive(Subdiagnostic)]`
334365
`#[derive(Subdiagnostic)]` supports the following attributes:
335366

336367
- `#[label(slug)]`, `#[help(slug)]`, `#[warning(slug)]` or `#[note(slug)]`

src/hir/lowering.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ of such structures include but are not limited to
77

88
* Parenthesis
99
* Removed without replacement, the tree structure makes order explicit
10-
* `for` loops and `while (let)` loops
11-
* Converted to `loop` + `match` and some `let` bindings
12-
* `if let`
13-
* Converted to `match`
10+
* `for` loops
11+
* Converted to `match` + `loop` + `match`
1412
* Universal `impl Trait`
1513
* Converted to generic arguments
1614
(but with some flags, to know that the user didn't write them)

src/solve/opaque-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Finally, we check whether the item bounds of the opaque hold for the expected ty
5656
[source][item-bounds-ck].
5757

5858
[norm]: https://github.com/rust-lang/rust/blob/384d26fc7e3bdd7687cc17b2662b091f6017ec2a/compiler/rustc_trait_selection/src/solve/normalizes_to/opaque_types.rs#L13
59-
[coherence-example]: https://github.com/rust-lang/rust/blob/master/tests/ui/type-alias-impl-trait/coherence_different_hidden_ty.rs
59+
[coherence-example]: https://github.com/rust-lang/rust/blob/master/tests/ui/type-alias-impl-trait/coherence/coherence_different_hidden_ty.rs
6060
[placeholder-ck]: https://github.com/rust-lang/rust/blob/384d26fc7e3bdd7687cc17b2662b091f6017ec2a/compiler/rustc_trait_selection/src/solve/normalizes_to/opaque_types.rs#L33
6161
[check-storage]: https://github.com/rust-lang/rust/blob/384d26fc7e3bdd7687cc17b2662b091f6017ec2a/compiler/rustc_trait_selection/src/solve/normalizes_to/opaque_types.rs#L51-L52
6262
[eq-prev]: https://github.com/rust-lang/rust/blob/384d26fc7e3bdd7687cc17b2662b091f6017ec2a/compiler/rustc_trait_selection/src/solve/normalizes_to/opaque_types.rs#L51-L59

src/tests/ci.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ kinds of builds (sets of jobs).
6666
### Pull Request builds
6767

6868
After each push to a pull request, a set of `pr` jobs are executed. Currently,
69-
these execute the `x86_64-gnu-llvm-X`, `x86_64-gnu-tools`, `mingw-check-1`, `mingw-check-2`
70-
and `mingw-check-tidy` jobs, all running on Linux. These execute a relatively short
69+
these execute the `x86_64-gnu-llvm-X`, `x86_64-gnu-tools`, `pr-check-1`, `pr-check-2`
70+
and `tidy` jobs, all running on Linux. These execute a relatively short
7171
(~40 minutes) and lightweight test suite that should catch common issues. More
7272
specifically, they run a set of lints, they try to perform a cross-compile check
7373
build to Windows mingw (without producing any artifacts) and they test the
@@ -148,6 +148,13 @@ for example `*msvc*` or `*-alt`. You can start at most 20 jobs in a single try b
148148
glob patterns, you might want to wrap them in backticks (`` ` ``) to avoid GitHub rendering
149149
the pattern as Markdown.
150150

151+
The job pattern needs to match one or more jobs defined in the `auto` or `optional` sections
152+
of [`jobs.yml`]:
153+
154+
- `auto` jobs are executed before a commit is merged into the `master` branch.
155+
- `optional` jobs are executed only when explicitly requested via a try build.
156+
They are typically used for tier 2 and tier 3 targets.
157+
151158
> **Using `try-job` PR description directives**
152159
>
153160
> 1. Identify which set of try-jobs you would like to exercise. You can

src/tests/minicore.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ If you find a `core` item to be missing from the [`minicore`] stub, consider
3939
adding it to the test auxiliary if it's likely to be used or is already needed
4040
by more than one test.
4141

42+
## Staying in sync with `core`
43+
44+
The `minicore` items must be kept up to date with `core`. For consistent
45+
diagnostic output between using `core` and `minicore`, any `diagnostic`
46+
attributes (e.g. `on_unimplemented`) should be replicated exactly in `minicore`.
47+
4248
## Example codegen test that uses `minicore`
4349

4450
```rust,no_run

0 commit comments

Comments
 (0)