@@ -62,7 +62,7 @@ if you want to learn more about `x.py`, [read this chapter][bootstrap].
62
62
The ` x.py ` command can be run directly on most Unix systems in the following format:
63
63
64
64
``` sh
65
- ./x.py < subcommand> [flags]
65
+ ./x < subcommand> [flags]
66
66
```
67
67
68
68
This is how the documentation and examples assume you are running ` x.py ` .
@@ -110,7 +110,7 @@ You can install it with `cargo install --path src/tools/x`.
110
110
111
111
## Create a ` config.toml `
112
112
113
- To start, run ` ./x.py setup ` and select the ` compiler ` defaults. This will do some initialization
113
+ To start, run ` ./x setup ` and select the ` compiler ` defaults. This will do some initialization
114
114
and create a ` config.toml ` for you with reasonable defaults. If you use a different default (which
115
115
you'll likely want to do if you want to contribute to an area of rust other than the compiler, such
116
116
as rustdoc), make sure to read information about that default (located in ` src/bootstrap/defaults ` )
@@ -120,24 +120,24 @@ Alternatively, you can write `config.toml` by hand. See `config.example.toml` fo
120
120
settings and explanations of them. See ` src/bootstrap/defaults ` for common settings to change.
121
121
122
122
If you have already built ` rustc ` and you change settings related to LLVM, then you may have to
123
- execute ` rm -rf build ` for subsequent configuration changes to take effect. Note that `./x.py
123
+ execute ` rm -rf build ` for subsequent configuration changes to take effect. Note that `./x
124
124
clean` will not cause a rebuild of LLVM.
125
125
126
126
## Common ` x.py ` commands
127
127
128
128
Here are the basic invocations of the ` x.py ` commands most commonly used when
129
129
working on ` rustc ` , ` std ` , ` rustdoc ` , and other tools.
130
130
131
- | Command | When to use it |
132
- | --- | --- |
133
- | ` ./x.py check ` | Quick check to see if most things compile; [ rust-analyzer can run this automatically for you] [ rust-analyzer ] |
134
- | ` ./x.py build ` | Builds ` rustc ` , ` std ` , and ` rustdoc ` |
135
- | ` ./x.py test ` | Runs all tests |
136
- | ` ./x.py fmt ` | Formats all code |
131
+ | Command | When to use it |
132
+ | ----------- | --------------------------------------------------------------------------------------------------------- --- |
133
+ | ` ./x check ` | Quick check to see if most things compile; [ rust-analyzer can run this automatically for you] [ rust-analyzer ] |
134
+ | ` ./x build ` | Builds ` rustc ` , ` std ` , and ` rustdoc ` |
135
+ | ` ./x test ` | Runs all tests |
136
+ | ` ./x fmt ` | Formats all code |
137
137
138
138
As written, these commands are reasonable starting points. However, there are
139
139
additional options and arguments for each of them that are worth learning for
140
- serious development work. In particular, ` ./x.py build ` and ` ./x.py test `
140
+ serious development work. In particular, ` ./x build ` and ` ./x test `
141
141
provide many ways to compile or test a subset of the code, which can save a lot
142
142
of time.
143
143
@@ -160,7 +160,7 @@ Once you've created a `config.toml`, you are now ready to run
160
160
probably the best "go to" command for building a local compiler:
161
161
162
162
``` bash
163
- ./x.py build library
163
+ ./x build library
164
164
```
165
165
166
166
This may * look* like it only builds the standard library, but that is not the case.
@@ -183,10 +183,10 @@ see [the section on avoiding rebuilds for std][keep-stage].
183
183
184
184
Sometimes you don't need a full build. When doing some kind of
185
185
"type-based refactoring", like renaming a method, or changing the
186
- signature of some function, you can use ` ./x.py check ` instead for a much faster build.
186
+ signature of some function, you can use ` ./x check ` instead for a much faster build.
187
187
188
188
Note that this whole command just gives you a subset of the full ` rustc `
189
- build. The ** full** ` rustc ` build (what you get with `./x.py build
189
+ build. The ** full** ` rustc ` build (what you get with `./x build
190
190
--stage 2 compiler/rustc`) has quite a few more steps:
191
191
192
192
- Build ` rustc ` with the stage1 compiler.
@@ -203,7 +203,7 @@ the compiler unless you are planning to use a recently added nightly feature.
203
203
Instead, you can just build using the bootstrap compiler.
204
204
205
205
``` bash
206
- ./x.py build --stage 0 library
206
+ ./x build --stage 0 library
207
207
```
208
208
209
209
If you choose the ` library ` profile when running ` x.py setup ` , you can omit ` --stage 0 ` (it's the
@@ -256,7 +256,7 @@ custom toolchain for a project (e.g. via `rustup override set stage1`) you may
256
256
want to build this component:
257
257
258
258
``` bash
259
- ./x.py build proc-macro-srv-cli
259
+ ./x build proc-macro-srv-cli
260
260
```
261
261
262
262
## Building targets for cross-compilation
@@ -267,7 +267,7 @@ For example, if your host platform is `x86_64-unknown-linux-gnu`
267
267
and your cross-compilation target is ` wasm32-wasi ` , you can build with:
268
268
269
269
``` bash
270
- ./x.py build --target x86_64-unknown-linux-gnu --target wasm32-wasi
270
+ ./x build --target x86_64-unknown-linux-gnu --target wasm32-wasi
271
271
```
272
272
273
273
Note that if you want the resulting compiler to be able to build crates that
@@ -309,18 +309,18 @@ Here are a few other useful `x.py` commands. We'll cover some of them in detail
309
309
in other sections:
310
310
311
311
- Building things:
312
- - ` ./x.py build ` – builds everything using the stage 1 compiler,
312
+ - ` ./x build ` – builds everything using the stage 1 compiler,
313
313
not just up to ` std `
314
- - ` ./x.py build --stage 2 ` – builds everything with the stage 2 compiler including
314
+ - ` ./x build --stage 2 ` – builds everything with the stage 2 compiler including
315
315
` rustdoc `
316
316
- Running tests (see the [ section on running tests] ( ../tests/running.html ) for
317
317
more details):
318
- - ` ./x.py test library/std ` – runs the unit tests and integration tests from ` std `
319
- - ` ./x.py test tests/ui ` – runs the ` ui ` test suite
320
- - ` ./x.py test tests/ui/const-generics ` - runs all the tests in
321
- the ` const-generics/ ` subdirectory of the ` ui ` test suite
322
- - ` ./x.py test tests/ui/const-generics/const-types.rs ` - runs
323
- the single test ` const-types.rs ` from the ` ui ` test suite
318
+ - ` ./x test library/std ` – runs the unit tests and integration tests from ` std `
319
+ - ` ./x test tests/ui ` – runs the ` ui ` test suite
320
+ - ` ./x test tests/ui/const-generics ` - runs all the tests in
321
+ the ` const-generics/ ` subdirectory of the ` ui ` test suite
322
+ - ` ./x test tests/ui/const-generics/const-types.rs ` - runs
323
+ the single test ` const-types.rs ` from the ` ui ` test suite
324
324
325
325
### Cleaning out build directories
326
326
@@ -330,7 +330,7 @@ you should file a bug as to what is going wrong. If you do need to clean
330
330
everything up then you only need to run one command!
331
331
332
332
``` bash
333
- ./x.py clean
333
+ ./x clean
334
334
```
335
335
336
336
` rm -rf build ` works too, but then you have to rebuild LLVM, which can take
0 commit comments