Skip to content
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

Rustc dev guide subtree update #135829

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
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
98d7162
Preparing for merge from rustc
Kobzol Jan 5, 2025
25beca9
add josh-sync build dir to gitignore (#2196)
BoxyUwU Jan 5, 2025
be5d781
Add rustc-dev-guide to the list of repositories managed by josh (#2197)
Kobzol Jan 6, 2025
8561cc8
Only keep label description in Forge docs
jieyouxu Jan 5, 2025
d91316e
Fix broken raw HTML (#2198)
max-heller Jan 7, 2025
a5e424e
Preparing for merge from rustc
Kobzol Jan 8, 2025
2f3ee5d
Merge from rustc
Kobzol Jan 8, 2025
5a11197
Merge pull request #2200 from Kobzol/rustc-pull
Kobzol Jan 8, 2025
9577119
Save linkcheck cache always
marxin Jan 6, 2025
1ffe0ea
Update key
marxin Jan 8, 2025
7e2a690
Print an explicit message if the base repo head commit is up-to-date
Kobzol Jan 8, 2025
f761e1a
Error if there is nothing to pull
Kobzol Jan 8, 2025
42c284e
Merge pull request #2030 from marxin/ci-cache
camelid Jan 9, 2025
b4297e7
ci: Remove incorrect use of `continue-on-error`
camelid Jan 9, 2025
ce0d5c1
Merge pull request #2203 from camelid/ci-fix
Kobzol Jan 9, 2025
fcbcc74
Document how to find the configuration used in CI
ehuss Jan 10, 2025
43848be
Fix calculate-job-matrix.py link
ehuss Jan 10, 2025
f53bce4
Merge pull request #2206 from ehuss/fix-matrix-link
jieyouxu Jan 10, 2025
90e0127
Merge pull request #2205 from ehuss/ci-config
jieyouxu Jan 10, 2025
980412f
Add CI workflow for performing rustc-pull
Kobzol Jan 8, 2025
31f855b
Fix some broken links
camelid Jan 15, 2025
284d05d
Merge pull request #2208 from camelid/fix-some-links
jieyouxu Jan 15, 2025
1327eeb
Merge pull request #2202 from Kobzol/pull-ci
jieyouxu Jan 15, 2025
4a03a9f
fix some more typos
rmehri01 Jan 15, 2025
1df83a7
Merge pull request #2209 from rmehri01/typos
jieyouxu Jan 15, 2025
f8f912d
nyaa
lcnr Jan 15, 2025
3423f1e
Merge pull request #2210 from lcnr/promote-type-tests
lcnr Jan 15, 2025
6a57fbf
compiletest: fix outdated `rustdoc-js` test suite name
jieyouxu Jan 17, 2025
b38aa65
Merge pull request #2212 from jieyouxu/fix-rustdoc-js
jieyouxu Jan 17, 2025
80c664a
remove outdated text about wfx implies
patrickoliveira15 Jan 17, 2025
84fdb51
Merge pull request #2211 from patrickoliveira15/patch/inference-invar…
JohnTitor Jan 17, 2025
d6b0828
docs: document how to install a suitable `josh-proxy` locally
jieyouxu Jan 18, 2025
24f264a
Merge pull request #2213 from jieyouxu/install-josh-proxy
jieyouxu Jan 20, 2025
29be13d
Add portable SIMD to list of subtrees
Kobzol Jan 20, 2025
808bd95
Preparing for merge from rustc
Kobzol Jan 20, 2025
1e0204b
Merge from rustc
Kobzol Jan 20, 2025
1b5b051
Merge pull request #2214 from Kobzol/subtree-portable-simd
jieyouxu Jan 20, 2025
470ab13
Merge pull request #2215 from Kobzol/pull
Kobzol Jan 20, 2025
28b5e11
Send a message to Zulip when a sync finishes
Kobzol Jan 20, 2025
a3f061c
Merge pull request #2216 from Kobzol/ci-pull-zulip
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
19 changes: 14 additions & 5 deletions src/doc/rustc-dev-guide/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ jobs:
~/.cargo/bin
key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK2_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}--${{ env.MDBOOK_MERMAID_VERSION }}

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

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

- name: Save cached Linkcheck
id: cache-linkcheck-save
if: ${{ !cancelled() && github.event_name == 'schedule' }}
uses: actions/cache/save@v4
with:
path: book/linkcheck/cache.json
key: linkcheck--${{ env.MDBOOK_LINKCHECK2_VERSION }}

- name: Deploy to gh-pages
if: github.event_name == 'push'
run: |
Expand Down
85 changes: 85 additions & 0 deletions src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: rustc-pull

on:
workflow_dispatch:
schedule:
# Run at 04:00 UTC every Monday
- cron: '0 4 * * 1'

jobs:
pull:
if: github.repository == 'rust-lang/rustc-dev-guide'
runs-on: ubuntu-latest
outputs:
pr_url: ${{ steps.update-pr.outputs.pr_url }}
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
# We need the full history for josh to work
fetch-depth: '0'
- name: Install stable Rust toolchain
run: rustup update stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: "josh-sync"
# Cache the josh directory with checked out rustc
cache-directories: "/home/runner/.cache/rustc-dev-guide-josh"
- name: Install josh
run: RUSTFLAGS="--cap-lints warn" cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r24.10.04
- name: Setup bot git name and email
run: |
git config --global user.name 'The rustc-dev-guide Cronjob Bot'
git config --global user.email '[email protected]'
- name: Perform rustc-pull
run: cargo run --manifest-path josh-sync/Cargo.toml -- rustc-pull
- name: Push changes to a branch
run: |
# Update a sticky branch that is used only for rustc pulls
BRANCH="rustc-pull"
git switch -c $BRANCH
git push -u origin $BRANCH --force
- name: Create pull request
id: update-pr
run: |
# Check if an open pull request for an rustc pull update already exists
# If it does, the previous push has just updated it
# If not, we create it now
RESULT=`gh pr list --author github-actions[bot] --state open -q 'map(select(.title=="Rustc pull update")) | length' --json title`
if [[ "$RESULT" -eq 0 ]]; then
echo "Creating new pull request"
PR_URL=gh pr create -B master --title 'Rustc pull update' --body 'Latest update from rustc.'
echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT
else
PR_URL=gh pr list --author github-actions[bot] --state open -q 'map(select(.title=="Rustc pull update")) | .[0].url' --json url,title
echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
send-zulip-message:
needs: [pull]
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
- name: Compute message
id: message
run: |
if [ "${{ needs.pull.result }}" == "failure" ];
then
WORKFLOW_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
echo "message=Rustc pull sync failed. Check out the [workflow URL]($WORKFLOW_URL)." >> $GITHUB_OUTPUT
else
echo "message=Rustc pull sync succeeded. Check out the [PR](${{ needs.pull.outputs.pr_url }})." >> $GITHUB_OUTPUT
fi
- name: Send a Zulip message about updated PR
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5
with:
api-key: ${{ secrets.ZULIP_API_TOKEN }}
email: "[email protected]"
organization-url: "https://rust-lang.zulipchat.com"
to: 196385
type: "stream"
topic: "Subtree sync automation"
content: ${{ steps.message.outputs.message }}
2 changes: 2 additions & 0 deletions src/doc/rustc-dev-guide/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ ci/date-check/target/

# Generated by check-in.sh
pulls.json

josh-sync/target
7 changes: 7 additions & 0 deletions src/doc/rustc-dev-guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ including the `<!-- toc -->` marker at the place where you want the TOC.

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.

You'll need to install `josh-proxy` locally via

```
cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r24.10.04
```
Older versions of `josh-proxy` may not round trip commits losslessly so it is important to install this exact version.

### Pull changes from `rust-lang/rust` into this repository
1) Checkout a new branch that will be used to create a PR into `rust-lang/rustc-dev-guide`
2) Run the pull command
Expand Down
4 changes: 3 additions & 1 deletion src/doc/rustc-dev-guide/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ exclude = [
# 500 is returned for HEAD request
"code\\.visualstudio\\.com/docs/editor/tasks",
]
cache-timeout = 86400
# The scheduled CI runs every day and so we need to reuse a part of the cache
# in order to face "Server returned 429 Too Many Requests" errors for github.com.
cache-timeout = 90000
warning-policy = "error"

[output.html.redirect]
Expand Down
15 changes: 15 additions & 0 deletions src/doc/rustc-dev-guide/josh-sync/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ impl GitSync {
let josh_url =
format!("http://localhost:{JOSH_PORT}/{UPSTREAM_REPO}.git@{commit}{JOSH_FILTER}.git");

let previous_base_commit = sh.read_file("rust-version")?.trim().to_string();
if previous_base_commit == commit {
return Err(anyhow::anyhow!("No changes since last pull"));
}

// Update rust-version file. As a separate commit, since making it part of
// the merge has confused the heck out of josh in the past.
// We pass `--no-verify` to avoid running git hooks.
Expand Down Expand Up @@ -76,12 +81,22 @@ impl GitSync {
};
let num_roots_before = num_roots()?;

let sha = cmd!(sh, "git rev-parse HEAD").output().context("FAILED to get current commit")?.stdout;

// Merge the fetched commit.
const MERGE_COMMIT_MESSAGE: &str = "Merge from rustc";
cmd!(sh, "git merge FETCH_HEAD --no-verify --no-ff -m {MERGE_COMMIT_MESSAGE}")
.run()
.context("FAILED to merge new commits, something went wrong")?;

let current_sha = cmd!(sh, "git rev-parse HEAD").output().context("FAILED to get current commit")?.stdout;
if current_sha == sha {
cmd!(sh, "git reset --hard HEAD^")
.run()
.expect("FAILED to clean up after creating the preparation commit");
return Err(anyhow::anyhow!("No merge was performed, nothing to pull. Rolled back the preparation commit."));
}

// Check that the number of roots did not increase.
if num_roots()? != num_roots_before {
bail!("Josh created a new root commit. This is probably not the history you want.");
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc-dev-guide/rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dcfa38fe234de9304169afc6638e81d0dd222c06
ecda83b30f0f68cf5692855dddc0bc38ee8863fc
3 changes: 1 addition & 2 deletions src/doc/rustc-dev-guide/src/appendix/code-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@ Item | Kind | Short description | Chapter |
`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)
`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)
`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)
`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)
`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)
`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)
`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)
`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)
`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)
`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)
`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)
`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)
`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)
`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)
`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)
`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)
`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)
`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)
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc-dev-guide/src/appendix/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Term | Meaning
<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))
<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)).
<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))
<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.
<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.
<span id="sess">`sess`</span> | The compiler _session_, which stores global data used throughout compilation
<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.
<span id="sigil">sigil</span> | Like a keyword but composed entirely of non-alphanumeric tokens. For example, `&` is a sigil for references.
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc-dev-guide/src/backend/backend-agnostic.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ heavily on other parts of the crate. The separation of the code must not affect
the logic of the code nor its performance.

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

1. replace all the LLVM-specific types by generics inside function signatures
and structure definitions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ It starts by calling `fn try_promote_type_test_subject`. This function takes the

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`

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`.
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`.

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.
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.

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.

Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc-dev-guide/src/bug-fix-procedure.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ that we use for unstable features:
Ideally, breaking changes should have landed on the **stable branch** of the
compiler before they are finalized.

<a id="guide">
<a id="guide"></a>

### Removing a lint

Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc-dev-guide/src/closure.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ The other option is to step through the code using lldb or gdb.

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

Let's start with [`upvar.rs`][upvar]. This file has something called
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc-dev-guide/src/const-eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Prominent examples are:
* need to be known to check for overlapping patterns

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

All uses of constant evaluation can either be categorized as "influencing the type system"
Expand Down
Loading
Loading