You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a follow-up to rust-lang#1279.
The "Getting Started" chapter is, TBH, pretty bad when it comes to the
stuff about building and testing. It has far too much detail and lots of
repetition, which would be overwhelming to a newcomer.
This commit removes most of it, leaving behind just quick mentions of
the most common `x.py` commands: `check`, `build`, `test`, `fmt`, with
links to the appropriate chapters for details. There were a few
interesting details that weren't covered elsewhere, so I moved those
into other chapters.
Here is a summary of the different commands for reference, but you probably
102
-
should still read the rest of the section:
101
+
Here are the basic invocations of the `x.py` commands most commonly used when
102
+
working on `rustc`, `std`, `rustdoc`, and other tools.
103
103
104
104
| Command | When to use it |
105
105
| --- | --- |
106
-
|`./x.py check`| Quick check to see if things compile; [rust-analyzer can run this automatically for you][rust-analyzer]|
107
-
|`./x.py build --stage 0 [library/std]`| Build only the standard library, without building the compiler |
108
-
|`./x.py build library/std`| Build just the 1st stage of the compiler, along with the standard library; this is faster than building stage 2 and usually good enough |
109
-
|`./x.py build --keep-stage 1 library/std`| Build the 1st stage of the compiler and skips rebuilding the standard library; this is useful after you've done an ordinary stage1 build to skip compilation time, but it can cause weird problems. (Just do a regular build to resolve.) |
110
-
|`./x.py test [--keep-stage 1]`| Run the test suite using the stage1 compiler |
111
-
|`./x.py test --bless [--keep-stage 1]`| Run the test suite using the stage1 compiler _and_ update expected test output. |
112
-
|`./x.py build --stage 2 compiler/rustc`| Do a full 2-stage build. You almost never want to do this. |
113
-
|`./x.py test --stage 2`| Do a full 2-stage build and run all tests. You almost never want to do this. |
114
-
115
-
To do a full 2-stage build of the whole compiler, you should run this (after
116
-
updating `config.toml` as mentioned above):
106
+
|`./x.py check`| Quick check to see if most things compile; [rust-analyzer can run this automatically for you][rust-analyzer]|
107
+
|`./x.py build`| Builds `rustc`, `std`, and `rustdoc`|
108
+
|`./x.py test`| Runs all tests |
109
+
|`./x.py fmt`| Formats all code |
117
110
118
-
```sh
119
-
./x.py build --stage 2 compiler/rustc
120
-
```
121
-
122
-
In the process, this will also necessarily build the standard libraries, and it
123
-
will build `rustdoc` (which doesn't take too long).
124
-
125
-
To build and test everything:
126
-
127
-
```sh
128
-
./x.py test
129
-
```
130
-
131
-
For most contributions, you only need to build stage 1, which saves a lot of time:
132
-
133
-
```sh
134
-
# Build the compiler (stage 1)
135
-
./x.py build library/std
136
-
137
-
# Subsequent builds
138
-
./x.py build --keep-stage 1 library/std
139
-
```
140
-
141
-
This will take a while, especially the first time. Be wary of accidentally
142
-
touching or formatting the compiler, as `x.py` will try to recompile it.
143
-
144
-
**NOTE**: The `--keep-stage 1` will _assume_ that the stage 0 standard library
145
-
does not need to be rebuilt, which is usually true, which will save some time.
146
-
However, if you are changing certain parts of the compiler, this may lead to
147
-
weird errors. Feel free to ask on [zulip][z] if you are running into issues.
148
-
149
-
This runs a ton of tests and takes a long time to complete. If you are
150
-
working on `rustc`, you can usually get by with only the [UI tests][uitests]. These
151
-
test are mostly for the frontend of the compiler, so if you are working on LLVM
152
-
or codegen, this shortcut will _not_ test your changes. You can read more about the
153
-
different test suites [in this chapter][testing].
111
+
As written, these commands are reasonable starting points. However, there are
112
+
additional options and arguments for each of them that are worth learning for
113
+
serious development work. In particular, `./x.py build` and `./x.py test`
114
+
provide many ways to compile or test a subset of the code, which can save a lot
0 commit comments