Skip to content

Commit 5f32dda

Browse files
authored
Merge branch 'master' into mir-queries
2 parents 43fc9a3 + 0bd5b6a commit 5f32dda

File tree

196 files changed

+10047
-4231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+10047
-4231
lines changed

.editorconfig

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ root = true
33
[src/*]
44
end_of_line = lf
55
insert_final_newline = true
6+
max_line_length = 100
67

78
[ci/*.sh]
89
indent_style = space

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Set the default behavior, in case people don't have core.autocrlf set.
22
* text=auto eol=lf
33

4+
# git grep shouldn't match entries in huge minified javascript
5+
*.min.js binary
6+
47
# Older git versions try to fix line endings on images, this prevents it.
58
*.png binary
69
*.jpg binary

.github/workflows/ci.yml

+11-17
Original file line numberDiff line numberDiff line change
@@ -14,45 +14,39 @@ jobs:
1414
if: github.repository == 'rust-lang/rustc-dev-guide'
1515
runs-on: ubuntu-latest
1616
env:
17-
MDBOOK_VERSION: 0.4.12
18-
MDBOOK_LINKCHECK_VERSION: 0.7.2
19-
MDBOOK_MERMAID_VERSION: 0.10.0
20-
MDBOOK_TOC_VERSION: 0.6.1
17+
MDBOOK_VERSION: 0.4.21
18+
MDBOOK_LINKCHECK_VERSION: 0.7.6
19+
MDBOOK_MERMAID_VERSION: 0.12.6
20+
MDBOOK_TOC_VERSION: 0.11.2
2121
DEPLOY_DIR: book/html
2222
BASE_SHA: ${{ github.event.pull_request.base.sha }}
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2324
steps:
24-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v4
2526
with:
2627
# linkcheck needs the base commit.
2728
fetch-depth: 0
2829

2930
- name: Cache binaries
3031
id: mdbook-cache
31-
uses: actions/cache@v2
32+
uses: actions/cache@v4
3233
with:
3334
path: |
3435
~/.cargo/bin
3536
key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}--${{ env.MDBOOK_MERMAID_VERSION }}
3637

3738
- name: Cache linkcheck
38-
uses: actions/cache@v2
39+
uses: actions/cache@v4
3940
with:
4041
path: |
4142
~/book/linkcheck
4243
key: ${{ runner.os }}-${{ hashFiles('./book/linkcheck') }}
4344

44-
- name: Check line lengths
45-
if: github.event_name != 'push'
46-
run: |
47-
shopt -s globstar
48-
MAX_LINE_LENGTH=100 bash ci/check_line_lengths.sh src/**/*.md
49-
5045
- name: Install latest nightly Rust toolchain
5146
if: steps.mdbook-cache.outputs.cache-hit != 'true'
52-
uses: actions-rs/toolchain@v1
53-
with:
54-
toolchain: nightly
55-
override: true
47+
run: |
48+
rustup update nightly
49+
rustup override set nightly
5650
5751
- name: Install Dependencies
5852
if: steps.mdbook-cache.outputs.cache-hit != 'true'

.github/workflows/date-check.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
steps:
1717
- name: Checkout repo
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@v4
1919

2020
- name: Ensure Rust is up-to-date
2121
run: |
@@ -27,17 +27,16 @@ jobs:
2727
cargo run -- ../../src/ > ../../date-check-output.txt
2828
2929
- name: Open issue
30-
uses: actions/github-script@v3
30+
uses: actions/github-script@v7
3131
with:
32-
github-token: ${{secrets.GITHUB_TOKEN}}
3332
script: |
3433
const fs = require('fs');
3534
3635
const rawText = fs.readFileSync('date-check-output.txt', { encoding: 'utf8' });
3736
const title = rawText.split('\n')[0];
3837
if (title != 'empty') {
3938
const body = rawText.split('\n').slice(1).join('\n');
40-
github.issues.create({
39+
github.rest.issues.create({
4140
owner: context.repo.owner,
4241
repo: context.repo.repo,
4342
title,

.mailmap

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
4+
5+
Jynn Nelson <[email protected]>

CITATION.cff

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cff-version: 1.2.0
2+
message: If you use this guide, please cite it using these metadata.
3+
title: Rust Compiler Development Guide (rustc-dev-guide)
4+
abstract: A guide to developing the Rust compiler (rustc)
5+
authors:
6+
- name: "The Rust Project Developers"
7+
date-released: "2018-01-16"
8+
license: "MIT OR Apache-2.0"
9+
repository-code: "https://github.com/rust-lang/rustc-dev-guide"

CODE_OF_CONDUCT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# The Rust Code of Conduct
22

3-
This repository follows the [Code of Conduct](https://www.rust-lang.org/conduct.html) of the Rust organization.
3+
This repository follows the [Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct) of the Rust organization.

README.md

+3-22
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ To build a local static HTML site, install [`mdbook`](https://github.com/rust-la
4949
and execute the following command in the root of the repository:
5050

5151
```
52-
> mdbook build
52+
> mdbook build --open
5353
```
5454

55-
The build files are found in the `book` directory.
55+
The build files are found in the `book/html` directory.
5656

5757
### Link Validations
5858

@@ -64,25 +64,6 @@ We use `mdbook-linkcheck` to validate URLs included in our documentation.
6464
We use `mdbook-toc` to auto-generate TOCs for long sections. You can invoke the preprocessor by
6565
including the `<!-- toc -->` marker at the place where you want the TOC.
6666

67-
### Pre-commit script
68-
69-
We also test that line lengths are less than 100 columns. To test this locally,
70-
you can run `ci/check_line_lengths.sh`.
71-
72-
You can also set this to run automatically.
73-
74-
On Linux:
75-
76-
```bash
77-
ln -s ../../ci/check_line_lengths.sh .git/hooks/pre-commit
78-
```
79-
80-
On Windows:
81-
82-
```powershell
83-
New-Item -Path .git/hooks/pre-commit -ItemType HardLink -Value <absolute_path/to/check_line_lengths.sh>
84-
```
85-
8667
## How to fix toolstate failures
8768

8869
> **NOTE**: Currently, we do not track the rustc-dev-guide toolstate due to
@@ -118,7 +99,7 @@ git submodule update --remote src/doc/rustc-dev-guide
11899
git add -u
119100
git commit -m "Update rustc-dev-guide"
120101
# Note that you can use -i, which is short for --incremental, in the following command
121-
./x.py test --incremental src/doc/rustc-dev-guide # This is optional and should succeed anyway
102+
./x test --incremental src/doc/rustc-dev-guide # This is optional and should succeed anyway
122103
# Open a PR in rust-lang/rust
123104
```
124105

book.toml

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[book]
2-
title = "Guide to Rustc Development"
3-
author = "Rustc developers"
4-
description = "A guide to developing rustc"
2+
title = "Rust Compiler Development Guide"
3+
author = "The Rust Project Developers"
4+
description = "A guide to developing the Rust compiler (rustc)"
55

66
[build]
77
create-missing = false
@@ -15,9 +15,12 @@ command = "mdbook-mermaid"
1515

1616
[output.html]
1717
git-repository-url = "https://github.com/rust-lang/rustc-dev-guide"
18-
edit-url-template = "https://github.com/rust-lang/rustc-dev-guide/tree/master/{path}?mode=edit"
18+
edit-url-template = "https://github.com/rust-lang/rustc-dev-guide/edit/master/{path}"
1919
additional-js = ["mermaid.min.js", "mermaid-init.js"]
2020

21+
[output.html.search]
22+
use-boolean-and = true
23+
2124
[output.html.fold]
2225
enable = true
2326
level = 0
@@ -35,11 +38,15 @@ exclude = [
3538
"www\\.amazon\\.com",
3639
"www\\.rustaceans\\.org",
3740
"play\\.rust-lang\\.org",
38-
"tomlee\\.co"
41+
"tomlee\\.co",
42+
"marketplace\\.visualstudio\\.com",
43+
"objects\\.githubusercontent\\.com"
3944
]
4045
cache-timeout = 86400
4146
warning-policy = "error"
4247

4348
[output.html.redirect]
4449
"/compiletest.html" = "tests/compiletest.html"
45-
"/diagnostics/sessiondiagnostic.html" = "diagnostics/diagnostic-structs.html"
50+
"/diagnostics/sessiondiagnostic.html" = "diagnostic-structs.html"
51+
"/diagnostics/diagnostic-codes.html" = "error-codes.html"
52+
"/miri.html" = "const-eval/interpret.html"

ci/check_line_lengths.sh

-43
This file was deleted.

ci/date-check/src/main.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::{
33
convert::TryInto as _,
44
env, fmt, fs,
55
path::{Path, PathBuf},
6+
process,
67
str::FromStr,
78
};
89

@@ -124,9 +125,12 @@ fn filter_dates(
124125
}
125126

126127
fn main() {
127-
let root_dir = env::args()
128-
.nth(1)
129-
.expect("expect root Markdown directory as CLI argument");
128+
let mut args = env::args();
129+
if args.len() == 1 {
130+
eprintln!("error: expected root Markdown directory as CLI argument");
131+
process::exit(1);
132+
}
133+
let root_dir = args.nth(1).unwrap();
130134
let root_dir_path = Path::new(&root_dir);
131135
let glob_pat = format!("{}/**/*.md", root_dir);
132136
let today_chrono = Utc::today();
@@ -166,8 +170,8 @@ fn main() {
166170

167171
for (path, dates) in dates_by_file {
168172
println!(
169-
"- [ ] {}",
170-
path.strip_prefix(&root_dir_path).unwrap().display()
173+
"- {}",
174+
path.strip_prefix(&root_dir_path).unwrap_or(&path).display(),
171175
);
172176
for (line, date) in dates {
173177
println!(" - [ ] line {}: {}", line, date);

ci/linkcheck.sh

+13-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
set -e
44
set -o pipefail
55

6+
set_github_token() {
7+
jq '.config.output.linkcheck."http-headers"."github\\.com" = ["Authorization: Bearer $GITHUB_TOKEN"]'
8+
}
9+
610
# https://docs.github.com/en/actions/reference/environment-variables
711
if [ "$GITHUB_EVENT_NAME" = "schedule" ] ; then # running in scheduled job
812
FLAGS=""
13+
USE_TOKEN=1
914

1015
echo "Doing full link check."
11-
set -x
1216
elif [ "$GITHUB_EVENT_NAME" = "pull_request" ] ; then # running in PR CI build
1317
if [ -z "$BASE_SHA" ]; then
1418
echo "error: unexpected state: BASE_SHA must be non-empty in CI"
@@ -17,9 +21,9 @@ elif [ "$GITHUB_EVENT_NAME" = "pull_request" ] ; then # running in PR CI build
1721

1822
CHANGED_FILES=$(git diff --name-only $BASE_SHA... | tr '\n' ' ')
1923
FLAGS="--no-cache -f $CHANGED_FILES"
24+
USE_TOKEN=1
2025

2126
echo "Checking files changed since $BASE_SHA: $CHANGED_FILES"
22-
set -x
2327
else # running locally
2428
COMMIT_RANGE=master...
2529
CHANGED_FILES=$(git diff --name-only $COMMIT_RANGE | tr '\n' ' ')
@@ -28,4 +32,10 @@ else # running locally
2832
echo "Checking files changed in $COMMIT_RANGE: $CHANGED_FILES"
2933
fi
3034

31-
exec mdbook-linkcheck $FLAGS
35+
echo "exec mdbook-linkcheck $FLAGS"
36+
if [ "$USE_TOKEN" = 1 ]; then
37+
config=$(set_github_token)
38+
exec mdbook-linkcheck $FLAGS <<<"$config"
39+
else
40+
exec mdbook-linkcheck $FLAGS
41+
fi

examples/README

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
For each example to compile, you will need to first run the following:
2+
3+
rustup component add rustc-dev llvm-tools
4+
5+
To create an executable:
6+
7+
rustc rustc-driver-example.rs
8+
9+
To run an executable:
10+
11+
rustup run nightly ./rustc-driver-example

0 commit comments

Comments
 (0)