Skip to content

Commit dcd43d3

Browse files
authored
Rollup merge of rust-lang#135829 - Kobzol:rustc-push, r=jieyouxu
Rustc dev guide subtree update r? ``@ghost``
2 parents ca5fa66 + a3f061c commit dcd43d3

31 files changed

+184
-106
lines changed

Diff for: src/doc/rustc-dev-guide/.github/workflows/ci.yml

+14-5
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ jobs:
3535
~/.cargo/bin
3636
key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK2_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}--${{ env.MDBOOK_MERMAID_VERSION }}
3737

38-
- name: Cache linkcheck
39-
uses: actions/cache@v4
38+
- name: Restore cached Linkcheck
39+
if: github.event_name == 'schedule'
40+
id: cache-linkcheck-restore
41+
uses: actions/cache/restore@v4
4042
with:
41-
path: |
42-
~/book/linkcheck
43-
key: ${{ runner.os }}-${{ hashFiles('./book/linkcheck') }}
43+
path: book/linkcheck/cache.json
44+
key: linkcheck--${{ env.MDBOOK_LINKCHECK2_VERSION }}
4445

4546
- name: Install latest nightly Rust toolchain
4647
if: steps.mdbook-cache.outputs.cache-hit != 'true'
@@ -59,6 +60,14 @@ jobs:
5960
- name: Check build
6061
run: ENABLE_LINKCHECK=1 mdbook build
6162

63+
- name: Save cached Linkcheck
64+
id: cache-linkcheck-save
65+
if: ${{ !cancelled() && github.event_name == 'schedule' }}
66+
uses: actions/cache/save@v4
67+
with:
68+
path: book/linkcheck/cache.json
69+
key: linkcheck--${{ env.MDBOOK_LINKCHECK2_VERSION }}
70+
6271
- name: Deploy to gh-pages
6372
if: github.event_name == 'push'
6473
run: |
+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: rustc-pull
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# Run at 04:00 UTC every Monday
7+
- cron: '0 4 * * 1'
8+
9+
jobs:
10+
pull:
11+
if: github.repository == 'rust-lang/rustc-dev-guide'
12+
runs-on: ubuntu-latest
13+
outputs:
14+
pr_url: ${{ steps.update-pr.outputs.pr_url }}
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
# We need the full history for josh to work
22+
fetch-depth: '0'
23+
- name: Install stable Rust toolchain
24+
run: rustup update stable
25+
- uses: Swatinem/rust-cache@v2
26+
with:
27+
workspaces: "josh-sync"
28+
# Cache the josh directory with checked out rustc
29+
cache-directories: "/home/runner/.cache/rustc-dev-guide-josh"
30+
- name: Install josh
31+
run: RUSTFLAGS="--cap-lints warn" cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r24.10.04
32+
- name: Setup bot git name and email
33+
run: |
34+
git config --global user.name 'The rustc-dev-guide Cronjob Bot'
35+
git config --global user.email '[email protected]'
36+
- name: Perform rustc-pull
37+
run: cargo run --manifest-path josh-sync/Cargo.toml -- rustc-pull
38+
- name: Push changes to a branch
39+
run: |
40+
# Update a sticky branch that is used only for rustc pulls
41+
BRANCH="rustc-pull"
42+
git switch -c $BRANCH
43+
git push -u origin $BRANCH --force
44+
- name: Create pull request
45+
id: update-pr
46+
run: |
47+
# Check if an open pull request for an rustc pull update already exists
48+
# If it does, the previous push has just updated it
49+
# If not, we create it now
50+
RESULT=`gh pr list --author github-actions[bot] --state open -q 'map(select(.title=="Rustc pull update")) | length' --json title`
51+
if [[ "$RESULT" -eq 0 ]]; then
52+
echo "Creating new pull request"
53+
PR_URL=gh pr create -B master --title 'Rustc pull update' --body 'Latest update from rustc.'
54+
echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT
55+
else
56+
PR_URL=gh pr list --author github-actions[bot] --state open -q 'map(select(.title=="Rustc pull update")) | .[0].url' --json url,title
57+
echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT
58+
fi
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
send-zulip-message:
62+
needs: [pull]
63+
if: ${{ !cancelled() }}
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Compute message
67+
id: message
68+
run: |
69+
if [ "${{ needs.pull.result }}" == "failure" ];
70+
then
71+
WORKFLOW_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
72+
echo "message=Rustc pull sync failed. Check out the [workflow URL]($WORKFLOW_URL)." >> $GITHUB_OUTPUT
73+
else
74+
echo "message=Rustc pull sync succeeded. Check out the [PR](${{ needs.pull.outputs.pr_url }})." >> $GITHUB_OUTPUT
75+
fi
76+
- name: Send a Zulip message about updated PR
77+
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5
78+
with:
79+
api-key: ${{ secrets.ZULIP_API_TOKEN }}
80+
81+
organization-url: "https://rust-lang.zulipchat.com"
82+
to: 196385
83+
type: "stream"
84+
topic: "Subtree sync automation"
85+
content: ${{ steps.message.outputs.message }}

Diff for: src/doc/rustc-dev-guide/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ ci/date-check/target/
44

55
# Generated by check-in.sh
66
pulls.json
7+
8+
josh-sync/target

Diff for: src/doc/rustc-dev-guide/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ including the `<!-- toc -->` marker at the place where you want the TOC.
7474

7575
This repository is linked to `rust-lang/rust` as a [josh](https://josh-project.github.io/josh/intro.html) subtree. You can use the following commands to synchronize the subtree in both directions.
7676

77+
You'll need to install `josh-proxy` locally via
78+
79+
```
80+
cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r24.10.04
81+
```
82+
Older versions of `josh-proxy` may not round trip commits losslessly so it is important to install this exact version.
83+
7784
### Pull changes from `rust-lang/rust` into this repository
7885
1) Checkout a new branch that will be used to create a PR into `rust-lang/rustc-dev-guide`
7986
2) Run the pull command

Diff for: src/doc/rustc-dev-guide/book.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ exclude = [
5252
# 500 is returned for HEAD request
5353
"code\\.visualstudio\\.com/docs/editor/tasks",
5454
]
55-
cache-timeout = 86400
55+
# The scheduled CI runs every day and so we need to reuse a part of the cache
56+
# in order to face "Server returned 429 Too Many Requests" errors for github.com.
57+
cache-timeout = 90000
5658
warning-policy = "error"
5759

5860
[output.html.redirect]

Diff for: src/doc/rustc-dev-guide/josh-sync/src/sync.rs

+15
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ impl GitSync {
4545
let josh_url =
4646
format!("http://localhost:{JOSH_PORT}/{UPSTREAM_REPO}.git@{commit}{JOSH_FILTER}.git");
4747

48+
let previous_base_commit = sh.read_file("rust-version")?.trim().to_string();
49+
if previous_base_commit == commit {
50+
return Err(anyhow::anyhow!("No changes since last pull"));
51+
}
52+
4853
// Update rust-version file. As a separate commit, since making it part of
4954
// the merge has confused the heck out of josh in the past.
5055
// We pass `--no-verify` to avoid running git hooks.
@@ -76,12 +81,22 @@ impl GitSync {
7681
};
7782
let num_roots_before = num_roots()?;
7883

84+
let sha = cmd!(sh, "git rev-parse HEAD").output().context("FAILED to get current commit")?.stdout;
85+
7986
// Merge the fetched commit.
8087
const MERGE_COMMIT_MESSAGE: &str = "Merge from rustc";
8188
cmd!(sh, "git merge FETCH_HEAD --no-verify --no-ff -m {MERGE_COMMIT_MESSAGE}")
8289
.run()
8390
.context("FAILED to merge new commits, something went wrong")?;
8491

92+
let current_sha = cmd!(sh, "git rev-parse HEAD").output().context("FAILED to get current commit")?.stdout;
93+
if current_sha == sha {
94+
cmd!(sh, "git reset --hard HEAD^")
95+
.run()
96+
.expect("FAILED to clean up after creating the preparation commit");
97+
return Err(anyhow::anyhow!("No merge was performed, nothing to pull. Rolled back the preparation commit."));
98+
}
99+
85100
// Check that the number of roots did not increase.
86101
if num_roots()? != num_roots_before {
87102
bail!("Josh created a new root commit. This is probably not the history you want.");

Diff for: src/doc/rustc-dev-guide/rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dcfa38fe234de9304169afc6638e81d0dd222c06
1+
ecda83b30f0f68cf5692855dddc0bc38ee8863fc

Diff for: src/doc/rustc-dev-guide/src/appendix/code-index.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,16 @@ Item | Kind | Short description | Chapter |
1414
`Diag` | struct | A struct for a compiler diagnostic, such as an error or lint | [Emitting Diagnostics] | [compiler/rustc_errors/src/diagnostic.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.Diag.html)
1515
`DocContext` | struct | A state container used by rustdoc when crawling through a crate to gather its documentation | [Rustdoc] | [src/librustdoc/core.rs](https://github.com/rust-lang/rust/blob/master/src/librustdoc/core.rs)
1616
`HirId` | struct | One of four types of HIR node identifiers | [Identifiers in the HIR] | [compiler/rustc_hir/src/hir_id.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir_id/struct.HirId.html)
17+
`Lexer` | struct | This is the lexer used during parsing. It consumes characters from the raw source code being compiled and produces a series of tokens for use by the rest of the parser | [The parser] | [compiler/rustc_parse/src/lexer/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/lexer/struct.Lexer.html)
1718
`NodeId` | struct | One of four types of HIR node identifiers. Being phased out | [Identifiers in the HIR] | [compiler/rustc_ast/src/ast.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/node_id/struct.NodeId.html)
1819
`P` | struct | An owned immutable smart pointer. By contrast, `&T` is not owned, and `Box<T>` is not immutable. | None | [compiler/rustc_ast/src/ptr.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/ptr/struct.P.html)
1920
`ParamEnv` | struct | Information about generic parameters or `Self`, useful for working with associated or generic items | [Parameter Environment] | [compiler/rustc_middle/src/ty/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ParamEnv.html)
2021
`ParseSess` | struct | This struct contains information about a parsing session | [The parser] | [compiler/rustc_session/src/parse/parse.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/parse/struct.ParseSess.html)
21-
`Query` | struct | Represents the result of query to the `Compiler` interface and allows stealing, borrowing, and returning the results of compiler passes. | [The Rustc Driver and Interface] | [compiler/rustc_interface/src/queries.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/queries/struct.Query.html)
2222
`Rib` | struct | Represents a single scope of names | [Name resolution] | [compiler/rustc_resolve/src/lib.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_resolve/late/struct.Rib.html)
2323
`Session` | struct | The data associated with a compilation session | [The parser], [The Rustc Driver and Interface] | [compiler/rustc_session/src/session.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/struct.Session.html)
2424
`SourceFile` | struct | Part of the `SourceMap`. Maps AST nodes to their source code for a single source file. Was previously called FileMap | [The parser] | [compiler/rustc_span/src/lib.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/struct.SourceFile.html)
2525
`SourceMap` | struct | Maps AST nodes to their source code. It is composed of `SourceFile`s. Was previously called CodeMap | [The parser] | [compiler/rustc_span/src/source_map.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/source_map/struct.SourceMap.html)
2626
`Span` | struct | A location in the user's source code, used for error reporting primarily | [Emitting Diagnostics] | [compiler/rustc_span/src/span_encoding.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/struct.Span.html)
27-
`StringReader` | struct | This is the lexer used during parsing. It consumes characters from the raw source code being compiled and produces a series of tokens for use by the rest of the parser | [The parser] | [compiler/rustc_parse/src/lexer/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/lexer/struct.StringReader.html)
2827
`rustc_ast::token_stream::TokenStream` | struct | An abstract sequence of tokens, organized into `TokenTree`s | [The parser], [Macro expansion] | [compiler/rustc_ast/src/tokenstream.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/tokenstream/struct.TokenStream.html)
2928
`TraitDef` | struct | This struct contains a trait's definition with type information | [The `ty` modules] | [compiler/rustc_middle/src/ty/trait_def.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/trait_def/struct.TraitDef.html)
3029
`TraitRef` | struct | The combination of a trait and its input types (e.g. `P0: Trait<P1...Pn>`) | [Trait Solving: Goals and Clauses] | [compiler/rustc_middle/src/ty/sty.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/type.TraitRef.html)

Diff for: src/doc/rustc-dev-guide/src/appendix/glossary.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Term | Meaning
6969
<span id="rib">rib</span> | A data structure in the name resolver that keeps track of a single scope for names. ([see more](../name-resolution.md))
7070
<span id="rpit">RPIT</span> | A return-position `impl Trait`. ([see the reference](https://doc.rust-lang.org/reference/types/impl-trait.html#abstract-return-types)).
7171
<span id="rpitit">RPITIT</span> | A return-position `impl Trait` in trait. Unlike RPIT, this is desugared to a generic associated type (GAT). Introduced in [RFC 3425](https://rust-lang.github.io/rfcs/3425-return-position-impl-trait-in-traits.html). ([see more](../return-position-impl-trait-in-trait.md))
72-
<span id="scrutinee">scrutinee</div> | A scrutinee is the expression that is matched on in `match` expressions and similar pattern matching constructs. For example, in `match x { A => 1, B => 2 }`, the expression `x` is the scrutinee.
72+
<span id="scrutinee">scrutinee</span> | A scrutinee is the expression that is matched on in `match` expressions and similar pattern matching constructs. For example, in `match x { A => 1, B => 2 }`, the expression `x` is the scrutinee.
7373
<span id="sess">`sess`</span> | The compiler _session_, which stores global data used throughout compilation
7474
<span id="side-tables">side tables</span> | Because the [AST](#ast) and HIR are immutable once created, we often carry extra information about them in the form of hashtables, indexed by the id of a particular node.
7575
<span id="sigil">sigil</span> | Like a keyword but composed entirely of non-alphanumeric tokens. For example, `&` is a sigil for references.

Diff for: src/doc/rustc-dev-guide/src/backend/backend-agnostic.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ heavily on other parts of the crate. The separation of the code must not affect
4545
the logic of the code nor its performance.
4646

4747
For these reasons, the separation process involves two transformations that
48-
have to be done at the same time for the resulting code to compile :
48+
have to be done at the same time for the resulting code to compile:
4949

5050
1. replace all the LLVM-specific types by generics inside function signatures
5151
and structure definitions;

Diff for: src/doc/rustc-dev-guide/src/borrow_check/region_inference/closure_constraints.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ It starts by calling `fn try_promote_type_test_subject`. This function takes the
3131

3232
We then promote the `lower_bound` into the context of the caller. If the lower bound is equal to a placeholder, we replace it with `'static`
3333

34-
We then look at all universal regions `uv` which are required to outlive `lower_bound`, i.e. for which borrow checking adding region constraints. For each of these we then emit a `ClosureOutlivesRequirement` for non-local universal regions which are known to outlive `uv`.
34+
We then look at all universal regions `uv` which are required to be outlived by `lower_bound`, i.e. for which borrow checking added region constraints. For each of these we then emit a `ClosureOutlivesRequirement` for all non-local universal regions which are known to outlive `uv`.
3535

36-
As we've already built the region graph of the closure at this point and emitted errors if that one is inconsistent, we are also able to assume that the outlive constraints `uv: lower_bound` hold.
36+
As we've already built the region graph of the closure at this point and separately check that it is consistent, we are also able to assume the outlive constraints `uv: lower_bound` here.
3737

3838
So if we have a type-outlives bounds we can't prove, e.g. `T: 'local_infer`, we use the region graph to go to universal variables `'a` with `'a: local_infer`. In case `'a` are local, we then use the assumed outlived constraints to go to non-local ones.
3939

Diff for: src/doc/rustc-dev-guide/src/bug-fix-procedure.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ that we use for unstable features:
227227
Ideally, breaking changes should have landed on the **stable branch** of the
228228
compiler before they are finalized.
229229

230-
<a id="guide">
230+
<a id="guide"></a>
231231

232232
### Removing a lint
233233

Diff for: src/doc/rustc-dev-guide/src/closure.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ The other option is to step through the code using lldb or gdb.
157157

158158
1. `rust-lldb build/host/stage1/bin/rustc test.rs`
159159
2. In lldb:
160-
1. `b upvar.rs:134` // Setting the breakpoint on a certain line in the upvar.rs file`
160+
1. `b upvar.rs:134` // Setting the breakpoint on a certain line in the upvar.rs file
161161
2. `r` // Run the program until it hits the breakpoint
162162

163163
Let's start with [`upvar.rs`][upvar]. This file has something called

Diff for: src/doc/rustc-dev-guide/src/const-eval.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Prominent examples are:
1717
* need to be known to check for overlapping patterns
1818

1919
Additionally constant evaluation can be used to reduce the workload or binary
20-
size at runtime by precomputing complex operations at compiletime and only
20+
size at runtime by precomputing complex operations at compile time and only
2121
storing the result.
2222

2323
All uses of constant evaluation can either be categorized as "influencing the type system"

0 commit comments

Comments
 (0)