Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d8b6752
describe bors try parent=sha builds
jdonszelmann Nov 12, 2025
9d1c273
update some uses of `master` in the devguide
jdonszelmann Nov 12, 2025
8c1cb5b
Merge pull request #2640 from jdonszelmann/try-parent-and-main-branch
jdonszelmann Nov 12, 2025
f6bc9d5
some updates and improvements
tshepang Nov 12, 2025
4fd2b77
Merge pull request #2639 from rust-lang/tshepang/default-branch
tshepang Nov 12, 2025
7b0c218
sembr implementing_new_features.md
tshepang Nov 12, 2025
4a845a6
typo
tshepang Nov 12, 2025
de3b053
add date marker
tshepang Nov 12, 2025
407da40
reduce overlong physical lines
tshepang Nov 12, 2025
0f497ce
needless repetition
tshepang Nov 12, 2025
7b35dd1
Merge pull request #2641 from rust-lang/tshepang/sembr
tshepang Nov 12, 2025
6d42077
do not ignore lines that are list entries
tshepang Nov 13, 2025
e4ef199
avoid surprising string handling behavior
tshepang Nov 13, 2025
5517b2c
sembr src/stabilization_guide.md
tshepang Nov 13, 2025
aefdfa8
some text improvements
tshepang Nov 13, 2025
9d16bc4
Merge pull request #2642 from rust-lang/tshepang/sembr
tshepang Nov 13, 2025
74caf6d
sembr implementing_new_features.md again
tshepang Nov 13, 2025
cf542b5
Merge pull request #2643 from rust-lang/tshepang/sembr
tshepang Nov 13, 2025
d5f14ae
use latest checkout action
tshepang Nov 13, 2025
662facc
ci: avoid sembr getting rebuilt on every push
tshepang Nov 13, 2025
e7cd6c6
ci: run sembr in release mode
tshepang Nov 13, 2025
d2a8e42
Merge pull request #2644 from rust-lang/tshepang/ci
tshepang Nov 13, 2025
a70b5c6
sembr sanitizers.md again
tshepang Nov 13, 2025
fe3871f
sembr: update lockfile
tshepang Nov 13, 2025
5d1dc38
handle another edge case
tshepang Nov 13, 2025
9ce4c1a
Merge pull request #2645 from rust-lang/tshepang/sembr
tshepang Nov 13, 2025
3dcaf9b
add missing " and -Zoffload=Enable flag
ZuseZ4 Nov 14, 2025
2bf2f44
Merge pull request #2646 from rust-lang/update-offload-docs
ZuseZ4 Nov 14, 2025
901183b
Prepare for merging from rust-lang/rust
invalid-email-address Nov 17, 2025
6367ba4
Merge ref '69d4d5fc0e4d' from rust-lang/rust
invalid-email-address Nov 17, 2025
8564d67
Merge pull request #2647 from rust-lang/rustc-pull
tshepang Nov 17, 2025
6766db0
Prepare for merging from rust-lang/rust
invalid-email-address Nov 17, 2025
a76d78b
Merge ref 'cc328c12382f' from rust-lang/rust
invalid-email-address Nov 17, 2025
239cf98
Merge pull request #2648 from rust-lang/rustc-pull
tshepang Nov 17, 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
14 changes: 12 additions & 2 deletions src/doc/rustc-dev-guide/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
# linkcheck needs the base commit.
fetch-depth: 0
Expand Down Expand Up @@ -83,8 +83,18 @@ jobs:
git commit -m "Deploy ${GITHUB_SHA} to gh-pages"
git push --quiet -f "https://x-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}" HEAD:gh-pages
- name: Cache sembr build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
ci/sembr/target/
key: sembr-${{ hashFiles('ci/sembr/Cargo.lock') }}

- name: Check if files comply with semantic line breaks
continue-on-error: true
run: |
# using split_inclusive that uses regex feature that uses an unstable feature
RUSTC_BOOTSTRAP=1 cargo run --manifest-path ci/sembr/Cargo.toml src
RUSTC_BOOTSTRAP=1 cargo run --release --manifest-path ci/sembr/Cargo.toml src
2 changes: 1 addition & 1 deletion src/doc/rustc-dev-guide/.github/workflows/date-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Ensure Rust is up-to-date
run: |
Expand Down
32 changes: 16 additions & 16 deletions src/doc/rustc-dev-guide/ci/sembr/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ version = 4

[[package]]
name = "aho-corasick"
version = "1.1.3"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
dependencies = [
"memchr",
]
Expand Down Expand Up @@ -69,29 +69,29 @@ checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"

[[package]]
name = "bstr"
version = "1.12.0"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4"
checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab"
dependencies = [
"memchr",
"serde",
]

[[package]]
name = "clap"
version = "4.5.50"
version = "4.5.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c2cfd7bf8a6017ddaa4e32ffe7403d547790db06bd171c1c53926faab501623"
checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5"
dependencies = [
"clap_builder",
"clap_derive",
]

[[package]]
name = "clap_builder"
version = "4.5.50"
version = "4.5.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a4c05b9e80c5ccd3a7ef080ad7b6ba7d6fc00a985b8b157197075677c82c7a0"
checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a"
dependencies = [
"anstream",
"anstyle",
Expand Down Expand Up @@ -184,9 +184,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"

[[package]]
name = "ignore"
version = "0.4.24"
version = "0.4.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81776e6f9464432afcc28d03e52eb101c93b6f0566f52aef2427663e700f0403"
checksum = "d3d782a365a015e0f5c04902246139249abf769125006fbe7649e2ee88169b4a"
dependencies = [
"crossbeam-deque",
"globset",
Expand Down Expand Up @@ -243,9 +243,9 @@ dependencies = [

[[package]]
name = "quote"
version = "1.0.41"
version = "1.0.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
dependencies = [
"proc-macro2",
]
Expand Down Expand Up @@ -336,9 +336,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"

[[package]]
name = "syn"
version = "2.0.108"
version = "2.0.110"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917"
checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -347,9 +347,9 @@ dependencies = [

[[package]]
name = "unicode-ident"
version = "1.0.20"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06"
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"

[[package]]
name = "utf8parse"
Expand Down
87 changes: 60 additions & 27 deletions src/doc/rustc-dev-guide/ci/sembr/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ struct Cli {
show_diff: bool,
}

static REGEX_IGNORE: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"^\s*(\d\.|\-|\*)\s+").unwrap());
static REGEX_IGNORE_END: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"(\.|\?|;|!)$").unwrap());
static REGEX_IGNORE_END: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"(\.|\?|;|!|,|\-)$").unwrap());
static REGEX_IGNORE_LINK_TARGETS: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"^\[.+\]: ").unwrap());
static REGEX_SPLIT: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"([^\.]\.|[^r]\?|;|!)\s+").unwrap());
LazyLock::new(|| Regex::new(r"([^\.\d\-\*]\.|[^r]\?|;|!)\s").unwrap());
// list elements, numbered (1.) or not (- and *)
static REGEX_LIST_ENTRY: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"^\s*(\d\.|\-|\*)\s+").unwrap());

fn main() -> Result<()> {
let cli = Cli::parse();
Expand Down Expand Up @@ -99,7 +101,6 @@ fn ignore(line: &str, in_code_block: bool) -> bool {
|| line.trim_start().starts_with('>')
|| line.starts_with('#')
|| line.trim().is_empty()
|| REGEX_IGNORE.is_match(line)
|| REGEX_IGNORE_LINK_TARGETS.is_match(line)
}

Expand All @@ -120,11 +121,19 @@ fn comply(content: &str) -> String {
continue;
}
if REGEX_SPLIT.is_match(&line) {
let indent = line.find(|ch: char| !ch.is_whitespace()).unwrap();
let new_lines: Vec<_> = line
.split_inclusive(&*REGEX_SPLIT)
.map(|portion| format!("{:indent$}{}", "", portion.trim()))
let indent = if let Some(regex_match) = REGEX_LIST_ENTRY.find(&line) {
regex_match.len()
} else {
line.find(|ch: char| !ch.is_whitespace()).unwrap()
};
let mut newly_split_lines = line.split_inclusive(&*REGEX_SPLIT);
let first = newly_split_lines.next().unwrap().trim_end().to_owned();
let mut remaining: Vec<_> = newly_split_lines
.map(|portion| format!("{:indent$}{}", "", portion.trim_end()))
.collect();
let mut new_lines = Vec::new();
new_lines.push(first);
new_lines.append(&mut remaining);
new_content.splice(new_n..=new_n, new_lines.clone());
new_n += new_lines.len() - 1;
}
Expand Down Expand Up @@ -168,7 +177,10 @@ fn lengthen_lines(content: &str, limit: usize) -> String {
let Some(next_line) = content.get(n + 1) else {
continue;
};
if ignore(next_line, in_code_block) || REGEX_IGNORE_END.is_match(line) {
if ignore(next_line, in_code_block)
|| REGEX_LIST_ENTRY.is_match(next_line)
|| REGEX_IGNORE_END.is_match(line)
{
continue;
}
if line.len() + next_line.len() < limit {
Expand All @@ -182,42 +194,47 @@ fn lengthen_lines(content: &str, limit: usize) -> String {

#[test]
fn test_sembr() {
let original = "\
let original = "
# some. heading
must! be; split? and. normalizes space
1. ignore numbered
must! be; split?
1. ignore a dot after number. but no further
ignore | tables
ignore e.g. and
ignore i.e. and
ignore E.g. too
- ignore. list
* ignore. list
- list. entry
* list. entry
```
some code. block
```
sentence with *italics* should not be ignored. truly.
git log main.. compiler
foo. bar. baz
";
let expected = "\
let expected = "
# some. heading
must!
be;
split?
and.
normalizes space
1. ignore numbered
1. ignore a dot after number.
but no further
ignore | tables
ignore e.g. and
ignore i.e. and
ignore E.g. too
- ignore. list
* ignore. list
- list.
entry
* list.
entry
```
some code. block
```
sentence with *italics* should not be ignored.
truly.
git log main.. compiler
foo.
bar.
baz
";
assert_eq!(expected, comply(original));
}
Expand All @@ -230,12 +247,28 @@ short sentences
<div class='warning'>
a bit of text inside
</div>
preserve next line
1. one
preserve next line
- two
preserve next line
* three
";
let expected = "\
do not split short sentences
<div class='warning'>
a bit of text inside
</div>
preserve next line
1. one
preserve next line
- two
preserve next line
* three
";
assert_eq!(expected, lengthen_lines(original, 50));
}
Expand Down Expand Up @@ -263,13 +296,13 @@ fn test_prettify_ignore_link_targets() {

#[test]
fn test_sembr_then_prettify() {
let original = "\
let original = "
hi there. do
not split
short sentences.
hi again.
";
let expected = "\
let expected = "
hi there.
do
not split
Expand All @@ -278,15 +311,15 @@ hi again.
";
let processed = comply(original);
assert_eq!(expected, processed);
let expected = "\
let expected = "
hi there.
do not split
short sentences.
hi again.
";
let processed = lengthen_lines(&processed, 50);
assert_eq!(expected, processed);
let expected = "\
let expected = "
hi there.
do not split short sentences.
hi again.
Expand All @@ -297,12 +330,12 @@ hi again.

#[test]
fn test_sembr_question_mark() {
let original = "\
let original = "
o? whatever
r? @reviewer
r? @reviewer
";
let expected = "\
let expected = "
o?
whatever
r? @reviewer
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 @@
8401398e1f14a24670ee1a3203713dc2f0f8b3a8
cc328c12382f05d8ddf6ffc8139deb7985270ad8
4 changes: 2 additions & 2 deletions src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ This instructs `git` to perform a "shallow clone", cloning the repository but tr
the last `N` commits.

Passing `--depth 1` tells `git` to clone the repository but truncate the history to the latest
commit that is on the `master` branch, which is usually fine for browsing the source code or
commit that is on the `main` branch, which is usually fine for browsing the source code or
building the compiler.

```bash
Expand Down Expand Up @@ -172,7 +172,7 @@ You can install it with `cargo install --path src/tools/x`.

To clarify that this is another global installed binary util, which is
similar to the one declared in section [What is `x.py`](#what-is-xpy), but
it works as an independent process to execute the `x.py` rather than calling the
it works as an independent process to execute the `x.py` rather than calling the
shell to run the platform related scripts.

## Create a `bootstrap.toml`
Expand Down
8 changes: 4 additions & 4 deletions src/doc/rustc-dev-guide/src/building/suggested.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ lets you use `cargo fmt`.
[the section on vscode]: suggested.md#configuring-rust-analyzer-for-rustc
[the section on rustup]: how-to-build-and-run.md?highlight=rustup#creating-a-rustup-toolchain

## Faster Builds with CI-rustc
## Faster Builds with CI-rustc

If you are not working on the compiler, you often don't need to build the compiler tree.
For example, you can skip building the compiler and only build the `library` tree or the
Expand Down Expand Up @@ -389,7 +389,7 @@ times, and having to update each clone individually.
Fortunately, Git has a better solution called [worktrees]. This lets you create
multiple "working trees", which all share the same Git database. Moreover,
because all of the worktrees share the same object database, if you update a
branch (e.g. master) in any of them, you can use the new commits from any of the
branch (e.g. `main`) in any of them, you can use the new commits from any of the
worktrees. One caveat, though, is that submodules do not get shared. They will
still be cloned multiple times.

Expand All @@ -403,10 +403,10 @@ command:
git worktree add ../rust2
```

Creating a new worktree for a new branch based on `master` looks like:
Creating a new worktree for a new branch based on `main` looks like:

```bash
git worktree add -b my-feature ../rust2 master
git worktree add -b my-feature ../rust2 main
```

You can then use that rust2 folder as a separate workspace for modifying and
Expand Down
Loading
Loading