Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-lang/rustc-dev-guide
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: rust-lang/rustc-dev-guide
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master-old
Choose a head ref
Loading
Showing with 349,089 additions and 108 deletions.
  1. +10 −0 .editorconfig
  2. +10 −0 .gitattributes
  3. +74 −0 .github/workflows/ci.yml
  4. +48 −0 .github/workflows/date-check.yml
  5. +5 −0 .gitignore
  6. +5 −0 .mailmap
  7. +9 −0 CITATION.cff
  8. +1 −0 CNAME
  9. +1 −36 CODE_OF_CONDUCT.md
  10. +90 −3 README.md
  11. +62 −3 book.toml
  12. +38 −0 ci/check-in.sh
  13. +342 −0 ci/date-check/Cargo.lock
  14. +12 −0 ci/date-check/Cargo.toml
  15. +356 −0 ci/date-check/src/main.rs
  16. +48 −0 ci/linkcheck.sh
  17. +11 −0 examples/README
  18. +92 −0 examples/rustc-driver-example.rs
  19. +99 −0 examples/rustc-driver-interacting-with-the-ast.rs
  20. +81 −0 examples/rustc-interface-example.rs
  21. +98 −0 examples/rustc-interface-getting-diagnostics.rs
  22. +430 −0 josh-sync/Cargo.lock
  23. +10 −0 josh-sync/Cargo.toml
  24. +4 −0 josh-sync/README.md
  25. +32 −0 josh-sync/src/main.rs
  26. +234 −0 josh-sync/src/sync.rs
  27. +1 −0 mermaid-init.js
  28. +4 −0 mermaid.min.js
  29. 0 rust-version
  30. +233 −0 src/SUMMARY.md
  31. +107 −0 src/about-this-guide.md
  32. +333 −0 src/appendix/background.md
  33. +92 −0 src/appendix/bibliography.md
  34. +45 −0 src/appendix/code-index.md
  35. +48 −0 src/appendix/compiler-lecture.md
  36. +104 −0 src/appendix/glossary.md
  37. +15 −0 src/appendix/humorust.md
  38. +163 −0 src/asm.md
  39. +48 −0 src/ast-lowering.md
  40. +31 −0 src/ast-validation.md
  41. +50 −0 src/attributes.md
  42. +209 −0 src/backend/backend-agnostic.md
  43. +79 −0 src/backend/codegen.md
  44. +258 −0 src/backend/debugging.md
  45. +281 −0 src/backend/implicit-caller-location.md
  46. +5 −0 src/backend/inline-asm.md
  47. +191 −0 src/backend/libs-and-metadata.md
  48. +57 −0 src/backend/lowering-mir.md
  49. +81 −0 src/backend/monomorph.md
  50. +237 −0 src/backend/updating-llvm.md
  51. +59 −0 src/borrow_check.md
  52. +156 −0 src/borrow_check/drop_check.md
  53. +50 −0 src/borrow_check/moves_and_initialization.md
  54. +129 −0 src/borrow_check/moves_and_initialization/move_paths.md
  55. +264 −0 src/borrow_check/opaque-types-region-inference-restrictions.md
  56. +236 −0 src/borrow_check/region_inference.md
  57. +43 −0 src/borrow_check/region_inference/closure_constraints.md
  58. +224 −0 src/borrow_check/region_inference/constraint_propagation.md
  59. +3 −0 src/borrow_check/region_inference/error_reporting.md
  60. +127 −0 src/borrow_check/region_inference/lifetime_parameters.md
  61. +193 −0 src/borrow_check/region_inference/member_constraints.md
  62. +442 −0 src/borrow_check/region_inference/placeholders_and_universes.md
  63. +100 −0 src/borrow_check/two_phase_borrows.md
  64. +64 −0 src/borrow_check/type_check.md
  65. +341 −0 src/bug-fix-procedure.md
  66. +51 −0 src/building/bootstrapping/how-bootstrap-does-it.md
  67. +21 −0 src/building/bootstrapping/intro.md
  68. +465 −0 src/building/bootstrapping/what-bootstrapping-does.md
  69. +31 −0 src/building/build-install-distribution-artifacts.md
  70. +51 −0 src/building/compiler-documenting.md
  71. +404 −0 src/building/how-to-build-and-run.md
  72. +179 −0 src/building/new-target.md
  73. +129 −0 src/building/optimized-build.md
  74. +41 −0 src/building/prerequisites.md
  75. +74 −0 src/building/quickstart.md
  76. +391 −0 src/building/suggested.md
  77. +33 −0 src/cli.md
  78. +215 −0 src/closure.md
  79. +95 −0 src/coherence.md
  80. +405 −0 src/compiler-debugging.md
  81. +215 −0 src/compiler-src.md
  82. +141 −0 src/compiler-team.md
  83. +50 −0 src/const-eval.md
  84. +238 −0 src/const-eval/interpret.md
  85. +544 −0 src/contributing.md
  86. +168 −0 src/conventions.md
  87. +293 −0 src/coroutine-closures.md
  88. +23 −0 src/crates-io.md
  89. +354 −0 src/debugging-support-in-rustc.md
  90. +1,012 −0 src/diagnostics.md
  91. +166 −0 src/diagnostics/diagnostic-items.md
  92. +401 −0 src/diagnostics/diagnostic-structs.md
  93. +104 −0 src/diagnostics/error-codes.md
  94. +33 −0 src/diagnostics/error-guaranteed.md
  95. +124 −0 src/diagnostics/lintstore.md
  96. +226 −0 src/diagnostics/translation.md
  97. +424 −0 src/early_late_parameters.md
  98. +66 −0 src/effects.md
  99. +127 −0 src/external-repos.md
  100. +3 −0 src/feature-gate-ck.md
  101. +84 −0 src/feature-gates.md
  102. +149 −0 src/fuzzing.md
  103. +28 −0 src/generic_parameters_summary.md
  104. +198 −0 src/getting-started.md
  105. +650 −0 src/git.md
  106. +336 −0 src/guides/editions.md
  107. +15 −0 src/hir-debugging.md
  108. +167 −0 src/hir.md
  109. BIN src/img/coverage-branch-counting-01.png
  110. BIN src/img/dataflow-graphviz-example.png
  111. BIN src/img/github-cli.png
  112. BIN src/img/github-whitespace-changes.png
  113. BIN src/img/llvm-cov-show-01.png
  114. BIN src/img/other-peoples-commits.png
  115. BIN src/img/rustbot-submodules.png
  116. BIN src/img/submodule-conflicts.png
  117. BIN src/img/wpa-initial-memory.png
  118. BIN src/img/wpa-stack.png
  119. +206 −0 src/implementing_new_features.md
  120. +129 −0 src/incrcomp-debugging.md
  121. +67 −0 src/lang-items.md
  122. +47 −0 src/licenses.md
  123. +139 −0 src/llvm-coverage-instrumentation.md
  124. +627 −0 src/macro-expansion.md
  125. +106 −0 src/memory.md
  126. +115 −0 src/method-lookup.md
  127. +148 −0 src/mir/construction.md
  128. +195 −0 src/mir/dataflow.md
  129. +93 −0 src/mir/debugging.md
  130. +195 −0 src/mir/drop-elaboration.md
  131. +355 −0 src/mir/index.md
  132. +270 −0 src/mir/mir_cfg.svg
  133. +27 −0 src/mir/mir_detailed.dot
  134. +300 −0 src/mir/mir_detailed.svg
  135. +10 −0 src/mir/mir_overview.dot
  136. +103 −0 src/mir/mir_overview.svg
  137. +112 −0 src/mir/optimizations.md
  138. +182 −0 src/mir/passes.md
  139. +55 −0 src/mir/visitor.md
  140. +193 −0 src/name-resolution.md
  141. +113 −0 src/notification-groups/about.md
  142. +53 −0 src/notification-groups/apple.md
  143. +23 −0 src/notification-groups/arm.md
  144. +90 −0 src/notification-groups/cleanup-crew.md
  145. +23 −0 src/notification-groups/emscripten.md
  146. +35 −0 src/notification-groups/llvm.md
  147. +23 −0 src/notification-groups/risc-v.md
  148. +23 −0 src/notification-groups/rust-for-linux.md
  149. +23 −0 src/notification-groups/wasi.md
  150. +23 −0 src/notification-groups/wasm.md
  151. +33 −0 src/notification-groups/windows.md
  152. +277 −0 src/opaque-types-impl-trait-inference.md
  153. +63 −0 src/opaque-types-type-alias-impl-trait.md
  154. +442 −0 src/overview.md
  155. +115 −0 src/panic-implementation.md
  156. +185 −0 src/parallel-rustc.md
  157. +44 −0 src/param_env/param_env_acquisition.md
  158. +83 −0 src/param_env/param_env_construction_internals.md
  159. +18 −0 src/param_env/param_env_summary.md
  160. +60 −0 src/param_env/param_env_what_is_it.md
  161. +14 −0 src/part-2-intro.md
  162. +10 −0 src/part-3-intro.md
  163. +12 −0 src/part-4-intro.md
  164. +57 −0 src/part-5-intro.md
  165. +218 −0 src/pat-exhaustive-checking.md
  166. +141 −0 src/profile-guided-optimization.md
  167. +113 −0 src/profiling.md
  168. +309 −0 src/profiling/with_perf.md
  169. +37 −0 src/profiling/with_rustc_perf.md
  170. +108 −0 src/profiling/wpa_profiling.md
  171. +104 −0 src/queries/example-0.counts.txt
  172. +313,330 −0 src/queries/example-0.html
  173. BIN src/queries/example-0.png
  174. +539 −0 src/queries/incremental-compilation-in-detail.md
  175. +165 −0 src/queries/incremental-compilation.md
  176. +213 −0 src/queries/query-evaluation-model-in-detail.md
  177. +223 −0 src/queries/salsa.md
  178. +258 −0 src/query.md
  179. +440 −0 src/return-position-impl-trait-in-trait.md
  180. +66 −0 src/rustbot.md
  181. +19 −0 src/rustc-driver/getting-diagnostics.md
  182. +15 −0 src/rustc-driver/interacting-with-the-ast.md
  183. +46 −0 src/rustc-driver/intro.md
  184. +325 −0 src/rustdoc-internals.md
  185. +526 −0 src/rustdoc-internals/search.md
  186. +183 −0 src/rustdoc.md
  187. +126 −0 src/sanitizers.md
  188. +184 −0 src/serialization.md
  189. +113 −0 src/solve/caching.md
  190. +83 −0 src/solve/canonicalization.md
  191. +250 −0 src/solve/coinduction.md
  192. +157 −0 src/solve/invariants.md
  193. +127 −0 src/solve/normalization.md
  194. +122 −0 src/solve/opaque-types.md
  195. +47 −0 src/solve/proof-trees.md
  196. +109 −0 src/solve/significant-changes.md
  197. +76 −0 src/solve/the-solver.md
  198. +47 −0 src/solve/trait-solving.md
  199. +0 −19 src/src/SUMMARY.md
  200. +0 −1 src/src/chap-010-how-to-build-and-run.md
  201. +0 −1 src/src/chap-020-running-tests.md
  202. +0 −1 src/src/chap-030-walkthrough.md
  203. +0 −1 src/src/chap-040-compiler-conventions.md
  204. +0 −1 src/src/chap-050-the-parser.md
  205. +0 −1 src/src/chap-060-macro-expansion.md
  206. +0 −1 src/src/chap-070-name-resolution.md
  207. +0 −1 src/src/chap-080-hir-lowering.md
  208. +0 −1 src/src/chap-090-ty.md
  209. +0 −1 src/src/chap-100-type-inference.md
  210. +0 −1 src/src/chap-110-trait-resolution.md
  211. +0 −1 src/src/chap-120-type-checking.md
  212. +0 −1 src/src/chap-130-mir-construction.md
  213. +0 −1 src/src/chap-140-mir-borrowck.md
  214. +0 −1 src/src/chap-150-mir-optimizations.md
  215. +0 −1 src/src/chap-160-trans.md
  216. +0 −31 src/src/glossary.md
  217. +185 −0 src/stability.md
  218. +196 −0 src/stabilization_guide.md
  219. +19 −0 src/syntax-intro.md
  220. +166 −0 src/test-implementation.md
  221. +200 −0 src/tests/adding.md
  222. +194 −0 src/tests/best-practices.md
  223. +421 −0 src/tests/ci.md
  224. +824 −0 src/tests/compiletest.md
  225. +45 −0 src/tests/crater.md
  226. +474 −0 src/tests/directives.md
  227. +52 −0 src/tests/docker.md
  228. +28 −0 src/tests/ecosystem.md
  229. +168 −0 src/tests/fuchsia.md
  230. +168 −0 src/tests/intro.md
  231. +54 −0 src/tests/minicore.md
  232. +40 −0 src/tests/misc.md
  233. +64 −0 src/tests/perf.md
  234. +409 −0 src/tests/running.md
  235. +51 −0 src/tests/rust-for-linux.md
  236. +59 −0 src/tests/suggest-tests.md
  237. +533 −0 src/tests/ui.md
  238. +87 −0 src/the-parser.md
  239. +269 −0 src/thir.md
  240. +231 −0 src/tracing.md
  241. +67 −0 src/traits/caching.md
  242. +247 −0 src/traits/canonical-queries.md
  243. +260 −0 src/traits/canonicalization.md
  244. +41 −0 src/traits/chalk.md
  245. +272 −0 src/traits/goals-and-clauses.md
  246. +127 −0 src/traits/hrtb.md
  247. +84 −0 src/traits/implied-bounds.md
  248. +187 −0 src/traits/lowering-to-logic.md
  249. +255 −0 src/traits/resolution.md
  250. +51 −0 src/traits/specialization.md
  251. +85 −0 src/traits/unsize.md
  252. +104 −0 src/ty-fold.md
  253. +326 −0 src/ty.md
  254. +51 −0 src/ty_module/binders.md
  255. +76 −0 src/ty_module/early_binder.md
  256. +128 −0 src/ty_module/generic_arguments.md
  257. +145 −0 src/ty_module/instantiating_binders.md
  258. +98 −0 src/ty_module/param_ty_const_regions.md
  259. +46 −0 src/type-checking.md
  260. +258 −0 src/type-inference.md
  261. +78 −0 src/unsafety-checking.md
  262. +318 −0 src/variance.md
  263. +276 −0 src/walkthrough.md
  264. +8 −0 triagebot.toml
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[src/*]
end_of_line = lf
insert_final_newline = true
max_line_length = 100

[ci/*.sh]
indent_style = space
indent_size = 2
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto eol=lf

# git grep shouldn't match entries in huge minified javascript
*.min.js binary

# Older git versions try to fix line endings on images, this prevents it.
*.png binary
*.jpg binary
*.ico binary
74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: CI

on:
push:
branches:
- master
pull_request:
schedule:
# Run at 18:00 UTC every day
- cron: '0 18 * * *'

jobs:
ci:
if: github.repository == 'rust-lang/rustc-dev-guide'
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: 0.4.21
MDBOOK_LINKCHECK2_VERSION: 0.8.1
MDBOOK_MERMAID_VERSION: 0.12.6
MDBOOK_TOC_VERSION: 0.11.2
DEPLOY_DIR: book/html
BASE_SHA: ${{ github.event.pull_request.base.sha }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
# linkcheck needs the base commit.
fetch-depth: 0

- name: Cache binaries
id: mdbook-cache
uses: actions/cache@v4
with:
path: |
~/.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
with:
path: |
~/book/linkcheck
key: ${{ runner.os }}-${{ hashFiles('./book/linkcheck') }}

- name: Install latest nightly Rust toolchain
if: steps.mdbook-cache.outputs.cache-hit != 'true'
run: |
rustup update nightly
rustup override set nightly
- name: Install Dependencies
if: steps.mdbook-cache.outputs.cache-hit != 'true'
run: |
cargo install mdbook --version ${{ env.MDBOOK_VERSION }}
cargo install mdbook-linkcheck2 --version ${{ env.MDBOOK_LINKCHECK2_VERSION }}
cargo install mdbook-toc --version ${{ env.MDBOOK_TOC_VERSION }}
cargo install mdbook-mermaid --version ${{ env.MDBOOK_MERMAID_VERSION }}
- name: Check build
run: ENABLE_LINKCHECK=1 mdbook build

- name: Deploy to gh-pages
if: github.event_name == 'push'
run: |
touch "${{ env.DEPLOY_DIR }}/.nojekyll"
cp CNAME "${{ env.DEPLOY_DIR }}"
cd "${{ env.DEPLOY_DIR }}"
rm -rf .git
git init
git config user.name "Deploy from CI"
git config user.email ""
git add .
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
48 changes: 48 additions & 0 deletions .github/workflows/date-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Date-Check

on:
schedule:
# Run at noon UTC every 1st of the month
- cron: '00 12 01 * *'

# Allow manually starting the workflow
workflow_dispatch:

jobs:
date-check:
if: github.repository == 'rust-lang/rustc-dev-guide'
runs-on: ubuntu-latest

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

- name: Ensure Rust is up-to-date
run: |
rustup update stable
- name: Run `date-check`
working-directory: ci/date-check
run: |
cargo run -- ../../src/ > ../../date-check-output.txt
- name: Open issue
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const rawText = fs.readFileSync('date-check-output.txt', { encoding: 'utf8' });
const title = rawText.split('\n')[0];
if (title != 'empty') {
const body = rawText.split('\n').slice(1).join('\n');
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title,
body,
});
console.log('Opened issue.');
} else {
console.log('No dates to triage.');
}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
book

ci/date-check/target/

# Generated by check-in.sh
pulls.json
5 changes: 5 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Jynn Nelson <github@jyn.dev> <jyn514@gmail.com>
Jynn Nelson <github@jyn.dev> <joshua@yottadb.com>
Jynn Nelson <github@jyn.dev> <jyn.nelson@redjack.com>
Jynn Nelson <github@jyn.dev> <jnelson@cloudflare.com>
Jynn Nelson <github@jyn.dev>
9 changes: 9 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cff-version: 1.2.0
message: If you use this guide, please cite it using these metadata.
title: Rust Compiler Development Guide (rustc-dev-guide)
abstract: A guide to developing the Rust compiler (rustc)
authors:
- name: "The Rust Project Developers"
date-released: "2018-01-16"
license: "MIT OR Apache-2.0"
repository-code: "https://github.com/rust-lang/rustc-dev-guide"
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rustc-dev-guide.rust-lang.org
37 changes: 1 addition & 36 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,3 @@
# The Rust Code of Conduct

A version of this document [can be found online](https://www.rust-lang.org/conduct.html).

## Conduct

**Contact**: [rust-mods@rust-lang.org](mailto:rust-mods@rust-lang.org)

* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.
* Please be kind and courteous. There's no need to be mean or rude.
* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and see how it works.
* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behaviour. We interpret the term "harassment" as including the definition in the <a href="http://citizencodeofconduct.org/">Citizen Code of Conduct</a>; if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups.
* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or made uncomfortable by a community member, please contact one of the channel ops or any of the [Rust moderation team](/team.html#Moderation) immediately. Whether you're a regular contributor or a newcomer, we care about making this community a safe place for you and we've got your back.
* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behaviour is not welcome.

## Moderation


These are the policies for upholding our community's standards of conduct. If you feel that a thread needs moderation, please contact the [Rust moderation team](/team.html#Moderation).

1. Remarks that violate the Rust standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks, are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner.)
2. Remarks that moderators find inappropriate, whether listed in the code of conduct or not, are also not allowed.
3. Moderators will first respond to such remarks with a warning.
4. If the warning is unheeded, the user will be "kicked," i.e., kicked out of the communication channel to cool off.
5. If the user comes back and continues to make trouble, they will be banned, i.e., indefinitely excluded.
6. Moderators may choose at their discretion to un-ban the user if it was a first offense and they offer the offended party a genuine apology.
7. If a moderator bans someone and you think it was unjustified, please take it up with that moderator, or with a different moderator, **in private**. Complaints about bans in-channel are not allowed.
8. Moderators are held to a higher standard than other community members. If a moderator creates an inappropriate situation, they should expect less leeway than others.

In the Rust community we strive to go the extra step to look out for each other. Don't just aim to be technically unimpeachable, try to be your best self. In particular, avoid flirting with offensive or sensitive issues, particularly if they're off-topic; this all too often leads to unnecessary fights, hurt feelings, and damaged trust; worse, it can drive people away from the community entirely.

And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good there was something you could've communicated better — remember that it's your responsibility to make your fellow Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their trust.

The enforcement policies listed above apply to all official Rust venues; including official IRC channels (#rust, #rust-internals, #rust-tools, #rust-libs, #rustc, #rust-beginners, #rust-docs, #rust-community, #rust-lang, and #cargo); GitHub repositories under rust-lang, rust-lang-nursery, and rust-lang-deprecated; and all forums under rust-lang.org (users.rust-lang.org, internals.rust-lang.org). For other projects adopting the Rust Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion.

*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](http://contributor-covenant.org/version/1/3/0/).*
This repository follows the [Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct) of the Rust organization.
93 changes: 90 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,90 @@
An attempt to docuemnt how the compiler works. The intention is to
bootstrap this "in repo" and eventually move the text over into the
main rustc repo.
[![CI](https://github.com/rust-lang/rustc-dev-guide/actions/workflows/ci.yml/badge.svg)](https://github.com/rust-lang/rustc-dev-guide/actions/workflows/ci.yml)


This is a collaborative effort to build a guide that explains how rustc
works. The aim of the guide is to help new contributors get oriented
to rustc, as well as to help more experienced folks in figuring out
some new part of the compiler that they haven't worked on before.

[You can read the latest version of the guide here.](https://rustc-dev-guide.rust-lang.org/)

You may also find the rustdocs [for the compiler itself][rustdocs] useful.
Note that these are not intended as a guide; it's recommended that you search
for the docs you're looking for instead of reading them top to bottom.

[rustdocs]: https://doc.rust-lang.org/nightly/nightly-rustc

For documentation on developing the standard library, see
[`std-dev-guide`](https://std-dev-guide.rust-lang.org/).

### Contributing to the guide

The guide is useful today, but it has a lot of work still to go.

If you'd like to help improve the guide, we'd love to have you! You can find
plenty of issues on the [issue
tracker](https://github.com/rust-lang/rustc-dev-guide/issues). Just post a
comment on the issue you would like to work on to make sure that we don't
accidentally duplicate work. If you think something is missing, please open an
issue about it!

**In general, if you don't know how the compiler works, that is not a
problem!** In that case, what we will do is to schedule a bit of time
for you to talk with someone who **does** know the code, or who wants
to pair with you and figure it out. Then you can work on writing up
what you learned.

In general, when writing about a particular part of the compiler's code, we
recommend that you link to the relevant parts of the [rustc
rustdocs][rustdocs].

### Build Instructions

To build a local static HTML site, install [`mdbook`](https://github.com/rust-lang/mdBook) with:

```
> cargo install mdbook mdbook-linkcheck2 mdbook-toc mdbook-mermaid
```

and execute the following command in the root of the repository:

```
> mdbook build --open
```

The build files are found in the `book/html` directory.

### Link Validations

We use `mdbook-linkcheck2` to validate URLs included in our documentation. Link
checking is **not** run by default locally, though it is in CI. To enable it
locally, set the environment variable `ENABLE_LINKCHECK=1` like in the
following example.

```console
$ ENABLE_LINKCHECK=1 mdbook serve
```

### Table of Contents

We use `mdbook-toc` to auto-generate TOCs for long sections. You can invoke the preprocessor by
including the `<!-- toc -->` marker at the place where you want the TOC.

## Synchronizing josh subtree with rustc

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.

### 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
```
$ cargo run --manifest-path josh-sync/Cargo.toml rustc-pull
```
3) Push the branch to your fork and create a PR into `rustc-dev-guide`
### Push changes from this repository into `rust-lang/rust`
1) Run the push command to create a branch named `<branch-name>` in a `rustc` fork under the `<gh-username>` account
```
$ cargo run --manifest-path josh-sync/Cargo.toml rustc-push <branch-name> <gh-username>
```
2) Create a PR from `<branch-name>` into `rust-lang/rust`
65 changes: 62 additions & 3 deletions book.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
[book]
title = "Guide to Rustc Development"
author = "Rustc developers"
description = "A guide to developing rustc "
title = "Rust Compiler Development Guide"
author = "The Rust Project Developers"
description = "A guide to developing the Rust compiler (rustc)"

[build]
create-missing = false

[preprocessor.toc]
command = "mdbook-toc"
renderer = ["html"]

[preprocessor.mermaid]
command = "mdbook-mermaid"

[output.html]
git-repository-url = "https://github.com/rust-lang/rustc-dev-guide"
edit-url-template = "https://github.com/rust-lang/rustc-dev-guide/edit/master/{path}"
additional-js = ["mermaid.min.js", "mermaid-init.js"]

[output.html.search]
use-boolean-and = true

[output.html.fold]
enable = true
level = 0

[output.linkcheck]
command = "ci/linkcheck.sh"
follow-web-links = true
exclude = [
"crates\\.io",
"gcc\\.godbolt\\.org",
"youtube\\.com",
"youtu\\.be",
"dl\\.acm\\.org",
"cs\\.bgu\\.ac\\.il",
"www\\.amazon\\.com",
"www\\.rustaceans\\.org",
"play\\.rust-lang\\.org",
"tomlee\\.co",
"marketplace\\.visualstudio\\.com",
"objects\\.githubusercontent\\.com",
# The bug listing URL works only if an user is logged in, otherwise one gets 404.
"github\\.com/issues\\?q=.*",
# Similarly 500 is sometimes returned here.
"github\\.com/rust-lang/rust/pulls\\?q=.*",
# 401 is returned here for unknown reason
"github\\.com/wesleywiser/rustc-bootstrap-wpa-analysis",
# Handle: connection closed before message completed
"microsoft\\.com/en-us/research/publication/",
# 500 is returned for HEAD request
"code\\.visualstudio\\.com/docs/editor/tasks",
]
cache-timeout = 86400
warning-policy = "error"

[output.html.redirect]
"/compiletest.html" = "tests/compiletest.html"
"/diagnostics/sessiondiagnostic.html" = "diagnostic-structs.html"
"/diagnostics/diagnostic-codes.html" = "error-codes.html"
"/miri.html" = "const-eval/interpret.html"
"/tests/integration.html" = "ecosystem.html"
"/tests/headers.html" = "directives.html"
Loading