From ffe359fe2b61a48b7b0e13dfbdbdbbc1abeab654 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 12 Jan 2026 20:07:26 +0200 Subject: [PATCH 1/6] another corner case --- src/doc/rustc-dev-guide/ci/sembr/src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/doc/rustc-dev-guide/ci/sembr/src/main.rs b/src/doc/rustc-dev-guide/ci/sembr/src/main.rs index d41a57d6f747..ebcd472d7012 100644 --- a/src/doc/rustc-dev-guide/ci/sembr/src/main.rs +++ b/src/doc/rustc-dev-guide/ci/sembr/src/main.rs @@ -80,6 +80,7 @@ fn ignore(line: &str, in_code_block: bool) -> bool { in_code_block || line.to_lowercase().contains("e.g.") || line.to_lowercase().contains("n.b.") + || line.contains(" etc.") || line.contains("i.e.") || line.contains("et. al") || line.contains('|') @@ -189,6 +190,7 @@ must! be. split? ignore | tables ignore e.g. and ignore i.e. and +ignore etc. and ignore E.g. too - list. entry * list. entry @@ -212,6 +214,7 @@ split? ignore | tables ignore e.g. and ignore i.e. and +ignore etc. and ignore E.g. too - list. entry From 52a5023e762475c7384c8711489dba916dd7fd3d Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 12 Jan 2026 20:08:03 +0200 Subject: [PATCH 2/6] sembr src/external-repos.md --- src/doc/rustc-dev-guide/src/external-repos.md | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/external-repos.md b/src/doc/rustc-dev-guide/src/external-repos.md index c43c1f680acf..3d5a0075389e 100644 --- a/src/doc/rustc-dev-guide/src/external-repos.md +++ b/src/doc/rustc-dev-guide/src/external-repos.md @@ -30,8 +30,8 @@ The following external projects are managed using some form of a `subtree`: In contrast to `submodule` dependencies (see below for those), the `subtree` dependencies are just regular files and directories which can be updated in tree. However, if possible, enhancements, bug fixes, etc. specific -to these tools should be filed against the tools directly in their respective -upstream repositories. The exception is that when rustc changes are required to +to these tools should be filed against the tools directly in their respective upstream repositories. +The exception is that when rustc changes are required to implement a new tool feature or test, that should happen in one collective rustc PR. `subtree` dependencies are currently managed by two distinct approaches: @@ -51,7 +51,9 @@ implement a new tool feature or test, that should happen in one collective rustc ### Josh subtrees -The [josh] tool is an alternative to git subtrees, which manages git history in a different way and scales better to larger repositories. Specific tooling is required to work with josh. We provide a helper [`rustc-josh-sync`][josh-sync] tool to help with the synchronization, described [below](#synchronizing-a-josh-subtree). +The [josh] tool is an alternative to git subtrees, which manages git history in a different way and scales better to larger repositories. +Specific tooling is required to work with josh. +We provide a helper [`rustc-josh-sync`][josh-sync] tool to help with the synchronization, described [below](#synchronizing-a-josh-subtree). ### Synchronizing a Josh subtree @@ -69,8 +71,7 @@ changes from the subtree to rust-lang/rust) are performed from the subtree repos switch to its repository checkout directory in your terminal). #### Performing pull -1) Checkout a new branch that will be used to create a PR into the subtree -2) Run the pull command +1) Checkout a new branch that will be used to create a PR into the subtree 2) Run the pull command ``` rustc-josh-sync pull ``` @@ -97,7 +98,8 @@ If you want to migrate a repository dependency from `git subtree` or `git submod Periodically the changes made to subtree based dependencies need to be synchronized between this repository and the upstream tool repositories. -Subtree synchronizations are typically handled by the respective tool maintainers. Other users +Subtree synchronizations are typically handled by the respective tool maintainers. +Other users are welcome to submit synchronization PRs, however, in order to do so you will need to modify your local git installation and follow a very precise set of instructions. These instructions are documented, along with several useful tips and tricks, in the @@ -108,8 +110,8 @@ use the correct corresponding subtree directory and remote repository. The synchronization process goes in two directions: `subtree push` and `subtree pull`. A `subtree push` takes all the changes that happened to the copy in this repo and creates commits -on the remote repo that match the local changes. Every local -commit that touched the subtree causes a commit on the remote repo, but +on the remote repo that match the local changes. +Every local commit that touched the subtree causes a commit on the remote repo, but is modified to move the files from the specified directory to the tool repo root. A `subtree pull` takes all changes since the last `subtree pull` @@ -119,14 +121,17 @@ the tool changes into the specified directory in the Rust repository. It is recommended that you always do a push first and get that merged to the default branch of the tool. Then, when you do a pull, the merge works without conflicts. While it's definitely possible to resolve conflicts during a pull, you may have to redo the conflict -resolution if your PR doesn't get merged fast enough and there are new conflicts. Do not try to +resolution if your PR doesn't get merged fast enough and there are new conflicts. +Do not try to rebase the result of a `git subtree pull`, rebasing merge commits is a bad idea in general. You always need to specify the `-P` prefix to the subtree directory and the corresponding remote -repository. If you specify the wrong directory or repository +repository. +If you specify the wrong directory or repository you'll get very fun merges that try to push the wrong directory to the wrong remote repository. Luckily you can just abort this without any consequences by throwing away either the pulled commits -in rustc or the pushed branch on the remote and try again. It is usually fairly obvious +in rustc or the pushed branch on the remote and try again. +It is usually fairly obvious that this is happening because you suddenly get thousands of commits that want to be synchronized. [clippy-sync-docs]: https://doc.rust-lang.org/nightly/clippy/development/infrastructure/sync.html @@ -140,8 +145,8 @@ repository's root directory!) git subtree add -P src/tools/clippy https://github.com/rust-lang/rust-clippy.git master ``` -This will create a new commit, which you may not rebase under any circumstances! Delete the commit -and redo the operation if you need to rebase. +This will create a new commit, which you may not rebase under any circumstances! +Delete the commit and redo the operation if you need to rebase. Now you're done, the `src/tools/clippy` directory behaves as if Clippy were part of the rustc monorepo, so no one but you (or others that synchronize @@ -149,24 +154,25 @@ subtrees) actually needs to use `git subtree`. ## External Dependencies (submodules) -Building Rust will also use external git repositories tracked using [git -submodules]. The complete list may be found in the [`.gitmodules`] file. Some -of these projects are required (like `stdarch` for the standard library) and +Building Rust will also use external git repositories tracked using [git submodules]. +The complete list may be found in the [`.gitmodules`] file. +Some of these projects are required (like `stdarch` for the standard library) and some of them are optional (like `src/doc/book`). Usage of submodules is discussed more in the [Using Git chapter](git.md#git-submodules). Some of the submodules are allowed to be in a "broken" state where they either don't build or their tests don't pass, e.g. the documentation books -like [The Rust Reference]. Maintainers of these projects will be notified -when the project is in a broken state, and they should fix them as soon -as possible. The current status is tracked on the [toolstate website]. +like [The Rust Reference]. +Maintainers of these projects will be notified +when the project is in a broken state, and they should fix them as soon as possible. +The current status is tracked on the [toolstate website]. More information may be found on the Forge [Toolstate chapter]. In practice, it is very rare for documentation to have broken toolstate. Breakage is not allowed in the beta and stable channels, and must be addressed -before the PR is merged. They are also not allowed to be broken on `main` in -the week leading up to the beta cut. +before the PR is merged. +They are also not allowed to be broken on `main` in the week leading up to the beta cut. [git submodules]: https://git-scm.com/book/en/v2/Git-Tools-Submodules [`.gitmodules`]: https://github.com/rust-lang/rust/blob/HEAD/.gitmodules From 2204cbd9871e6052d4f7ffcddf0de0bbdeb879ad Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 12 Jan 2026 20:14:36 +0200 Subject: [PATCH 3/6] "in tree" should be "in-tree" --- src/doc/rustc-dev-guide/src/external-repos.md | 2 +- src/doc/rustc-dev-guide/src/tests/directives.md | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/external-repos.md b/src/doc/rustc-dev-guide/src/external-repos.md index 3d5a0075389e..c5e5b40e5a25 100644 --- a/src/doc/rustc-dev-guide/src/external-repos.md +++ b/src/doc/rustc-dev-guide/src/external-repos.md @@ -29,7 +29,7 @@ The following external projects are managed using some form of a `subtree`: In contrast to `submodule` dependencies (see below for those), the `subtree` dependencies are just regular files and directories which can -be updated in tree. However, if possible, enhancements, bug fixes, etc. specific +be updated in-tree. However, if possible, enhancements, bug fixes, etc. specific to these tools should be filed against the tools directly in their respective upstream repositories. The exception is that when rustc changes are required to implement a new tool feature or test, that should happen in one collective rustc PR. diff --git a/src/doc/rustc-dev-guide/src/tests/directives.md b/src/doc/rustc-dev-guide/src/tests/directives.md index 52e1f09dca0f..83272a769a54 100644 --- a/src/doc/rustc-dev-guide/src/tests/directives.md +++ b/src/doc/rustc-dev-guide/src/tests/directives.md @@ -130,7 +130,7 @@ means the test won't be compiled or run. main test files but that `compiletest` should not try to build the file itself. Please backlink to which main test is actually using the auxiliary file. * `ignore-test` always ignores the test. This can be used to temporarily disable - a test if it is currently not working, but you want to keep it in tree to + a test if it is currently not working, but you want to keep it in-tree to re-enable it later. Some examples of `X` in `ignore-X` or `only-X`: @@ -211,7 +211,7 @@ settings: - `needs-target-std` — ignores if target platform does not have std support. - `ignore-backends` — ignores the listed backends, separated by whitespace characters. Please note that this directive can be overriden with the `--bypass-ignore-backends=[BACKEND]` command line - flag. + flag. - `needs-backends` — only runs the test if current codegen backend is listed. - `needs-offload` — ignores if our LLVM backend was not built with offload support. - `needs-enzyme` — ignores if our Enzyme submodule was not built. @@ -290,9 +290,9 @@ You can also force `./x test` to use a specific edition by passing the `-- --edi However, tests with the `//@ edition` directive will clamp the value passed to the argument. For example, if we run `./x test -- --edition=2015`: -- A test with the `//@ edition: 2018` will run with the 2018 edition. -- A test with the `//@ edition: 2015..2021` will be run with the 2015 edition. -- A test with the `//@ edition: 2018..` will run with the 2018 edition. +- A test with the `//@ edition: 2018` will run with the 2018 edition. +- A test with the `//@ edition: 2015..2021` will be run with the 2015 edition. +- A test with the `//@ edition: 2018..` will run with the 2018 edition. ### Rustdoc From c4b05c3883e00eaa7eeec854ded90a9f9576c4fd Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 12 Jan 2026 20:24:28 +0200 Subject: [PATCH 4/6] fix sembr tool limitation --- src/doc/rustc-dev-guide/src/external-repos.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/external-repos.md b/src/doc/rustc-dev-guide/src/external-repos.md index c5e5b40e5a25..7c8cc3b5d62c 100644 --- a/src/doc/rustc-dev-guide/src/external-repos.md +++ b/src/doc/rustc-dev-guide/src/external-repos.md @@ -71,11 +71,12 @@ changes from the subtree to rust-lang/rust) are performed from the subtree repos switch to its repository checkout directory in your terminal). #### Performing pull -1) Checkout a new branch that will be used to create a PR into the subtree 2) Run the pull command +1. Checkout a new branch that will be used to create a PR into the subtree +2. Run the pull command ``` rustc-josh-sync pull ``` -3) Push the branch to your fork and create a PR into the subtree repository +3. Push the branch to your fork and create a PR into the subtree repository - If you have `gh` CLI installed, `rustc-josh-sync` can create the PR for you. #### Performing push @@ -83,11 +84,11 @@ switch to its repository checkout directory in your terminal). > NOTE: > Before you proceed, look at some guidance related to Git [on josh-sync README]. -1) Run the push command to create a branch named `` in a `rustc` fork under the `` account +1. Run the push command to create a branch named `` in a `rustc` fork under the `` account ``` rustc-josh-sync push ``` -2) Create a PR from `` into `rust-lang/rust` +2. Create a PR from `` into `rust-lang/rust` ### Creating a new Josh subtree dependency From 9a81699f061c0ec39efda7cb5c959a309ad7f71f Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 12 Jan 2026 20:24:52 +0200 Subject: [PATCH 5/6] use a stronger pause --- src/doc/rustc-dev-guide/src/external-repos.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rustc-dev-guide/src/external-repos.md b/src/doc/rustc-dev-guide/src/external-repos.md index 7c8cc3b5d62c..2e32fcfe78c1 100644 --- a/src/doc/rustc-dev-guide/src/external-repos.md +++ b/src/doc/rustc-dev-guide/src/external-repos.md @@ -124,7 +124,7 @@ Then, when you do a pull, the merge works without conflicts. While it's definitely possible to resolve conflicts during a pull, you may have to redo the conflict resolution if your PR doesn't get merged fast enough and there are new conflicts. Do not try to -rebase the result of a `git subtree pull`, rebasing merge commits is a bad idea in general. +rebase the result of a `git subtree pull`; rebasing merge commits is a bad idea in general. You always need to specify the `-P` prefix to the subtree directory and the corresponding remote repository. From 98e65aa454b6bfc157ca719551e387c20e0367c6 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 12 Jan 2026 20:42:16 +0200 Subject: [PATCH 6/6] handle another numbered list notation --- src/doc/rustc-dev-guide/ci/sembr/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/doc/rustc-dev-guide/ci/sembr/src/main.rs b/src/doc/rustc-dev-guide/ci/sembr/src/main.rs index ebcd472d7012..6f4ce4415f04 100644 --- a/src/doc/rustc-dev-guide/ci/sembr/src/main.rs +++ b/src/doc/rustc-dev-guide/ci/sembr/src/main.rs @@ -27,7 +27,7 @@ static REGEX_SPLIT: LazyLock = LazyLock::new(|| Regex::new(r"([^\.\d\-\*]\.|[^r]\?|!)\s").unwrap()); // list elements, numbered (1.) or not (- and *) static REGEX_LIST_ENTRY: LazyLock = - LazyLock::new(|| Regex::new(r"^\s*(\d\.|\-|\*)\s+").unwrap()); + LazyLock::new(|| Regex::new(r"^\s*(\d\.|\-|\*|\d\))\s+").unwrap()); fn main() -> Result<()> { let cli = Cli::parse(); @@ -194,6 +194,7 @@ ignore etc. and ignore E.g. too - list. entry * list. entry + 1) list. entry ``` some code. block ``` @@ -220,6 +221,8 @@ ignore E.g. too entry * list. entry + 1) list. + entry ``` some code. block ```