@@ -77,22 +77,24 @@ recommend trying to build on a Raspberry Pi :P
7777
7878Building the compiler takes more than half an hour on my moderately powerful
7979laptop. The first time you build the compiler, LLVM will also be built unless
80- you use your system's LLVM (see below).
80+ you use your system's LLVM ([ see below] [ configsec ] ).
81+
82+ [ configsec ] : #configuring-the-compiler
8183
8284Like ` cargo ` , the build system will use as many cores as possible. Sometimes
8385this can cause you to run low on memory. You can use ` -j ` to adjust the number
8486concurrent jobs.
8587
8688Also, if you don't have too much free disk space, you may want to turn off
87- incremental compilation (see the "Configuring" section below). This will make
89+ incremental compilation ([ see below] [ configsec ] ). This will make
8890compilation take longer, but will save a ton of space from the incremental
8991caches.
9092
9193### Cloning
9294
9395You can just do a normal git clone:
9496
95- ``` shell
97+ ``` sh
9698git clone https://github.com/rust-lang/rust.git
9799```
98100
@@ -107,9 +109,6 @@ git submodule update --init --recursive
107109git submodule update
108110```
109111
110- ** Pro tip** : if you contribute often, you may want to look at the git worktrees
111- tip in [ this chapter] [ suggested ] .
112-
113112### Configuring the Compiler
114113
115114The compiler has a configuration file which contains a ton of settings. We will
@@ -120,7 +119,7 @@ this chapter for more info][config].
120119
121120In the top level of the repo:
122121
123- ``` shell
122+ ``` sh
124123cp config.toml.example config.toml
125124```
126125
@@ -134,13 +133,16 @@ the following settings:
134133 Also, it can consume a lot of disk space. This has the same effect as the
135134 ` -i ` or ` --incremental ` flags.
136135- ` llvm-config ` : enables building with system LLVM. [ See this chapter] [ sysllvm ]
137- for more info. This avoids building LLVM, which can take a while.
136+ for more info. This avoids building LLVM, which can take a while (45 minutes
137+ on my laptop; others have reported 15 minutes or faster with incremental
138+ compilation).
138139
139140[ sysllvm ] : ./building/suggested.html#building-with-system-llvm
140141
141142### ` ./x.py ` Intro
142143
143- ` rustc ` is a _ bootstrapping_ compiler, which means that it is written in Rust and thus needs to be compiled by itself. So where do you
144+ ` rustc ` is a _ bootstrapping_ compiler, which means that it is written in Rust
145+ and thus needs to be compiled by itself. So where do you
144146get the original compiler from? We use the current beta compiler
145147to build a new compiler. Then, we use that compiler to build itself. Thus,
146148` rustc ` has a 2-stage build. You can read more about bootstrapping
@@ -179,7 +181,7 @@ To build and test everything:
179181
180182For most contributions, you only need to build stage 1, which saves a lot of time:
181183
182- ``` shell
184+ ``` sh
183185# Build the compiler (stage 1)
184186./x.py build --stage 1
185187
@@ -216,7 +218,7 @@ While working on the compiler, it can be helpful to see if the code just
216218compiles (similar to ` cargo check ` ) without actually building it. You can do
217219this with:
218220
219- ``` shell
221+ ``` sh
220222./x.py check
221223```
222224
@@ -226,7 +228,7 @@ completes in a couple of minutes on my laptop.
226228Finally, the CI ensures that the codebase is using consistent style. To format
227229the code:
228230
229- ``` shell
231+ ``` sh
230232# Actually format
231233./x.py fmt
232234
@@ -237,7 +239,9 @@ the code:
237239* Note* : we don't use stable ` rustfmt ` ; we use a pinned version with a special
238240config, so this may result in different style from normal ` rustfmt ` if you have
239241format-on-save turned on. It's a good habit to run ` ./x.py fmt ` before every
240- commit, as this reduces conflicts later.
242+ commit, as this reduces conflicts later. The pinned verson is built under
243+ ` build/<target>/stage0/bin/rustfmt ` , so if you want, you can use it for a
244+ single file or for format-on-save in your editor, which can be faster than ` ./x.py fmt ` .
241245
242246On last thing: you can use ` RUSTC_LOG=XXX ` to get debug logging. [ Read more
243247here] [ logging ] . Notice the ` C ` in ` RUSTC_LOG ` . Other than that, it uses normal
@@ -347,8 +351,10 @@ writing `r? @user` (e.g. `r? @eddyb`) in either the original post or a followup
347351comment.
348352
349353The reviewer may request some changes using the GitHub code review interface.
350- They may also request special procedures (such as a crater run; see below) for
351- some PRs.
354+ They may also request special procedures (such as a [ crater] run; [ see
355+ below] [ break ] ) for some PRs.
356+
357+ [ break ] : #breaking-changes
352358
353359When the PR is ready to be merged, the reviewer will issue a command to
354360` @bors ` , the CI bot. Usually, this is ` @bors r+ ` or ` @bors r=@user ` to approve
@@ -386,7 +392,7 @@ channels: stable, beta, and nightly.
386392
387393In order to implement a new feature, usually you will need to go through [ the
388394RFC process] [ rfc ] to propose a design, have discussions, etc. In some cases,
389- small features can be added with only an FCP (see below). If in doubt, ask the
395+ small features can be added with only an FCP ([ see below] [ break ] ). If in doubt, ask the
390396compiler, language, or libs team (whichever is most relevant).
391397
392398[ rfc ] : https://github.com/rust-lang/rfcs/blob/master/README.md
@@ -399,7 +405,8 @@ The feature then needs to be implemented behind a feature gate, which prevents
399405it from being accidentally used.
400406
401407Finally, somebody may propose stabilizing the feature in an upcoming version of
402- Rust. This requires a Final Comment Period (see below) to get the approval of the relevant teams.
408+ Rust. This requires a Final Comment Period ([ see below] [ break ] ) to get the
409+ approval of the relevant teams.
403410
404411After that, the feature gate can be removed and the feature turned on for all users.
405412
0 commit comments