@@ -108,6 +108,29 @@ of a checkout. It also looks up the appropriate version of `python` to use.
108108
109109You can install it with ` cargo install --path src/tools/x ` .
110110
111+ Using ` x ` rather than ` x.py ` is recommended as:
112+
113+ > ` ./x ` is the most likely to work on every system (on Unix it runs the shell script
114+ > that does python version detection, on Windows it will probably run the
115+ > powershell script - certainly less likely to break than ` ./x.py ` which often just
116+ > opens the file in an editor).[ ^ 1 ]
117+
118+ Notice that this is not absolute, for instance, using Nushell in VSCode on Win10,
119+ typing ` x ` or ` ./x ` still open the ` x.py ` in editor rather invoke the program :)
120+
121+ In the rest of documents, we use ` x ` to represent the straightly usage of ` x.py ` , which
122+ means the following command:
123+
124+ ``` bash
125+ ./x check
126+ ```
127+
128+ could been replaced by:
129+
130+ ``` bash
131+ ./x.py check
132+ ```
133+
111134## Create a ` config.toml `
112135
113136To start, run ` ./x setup ` and select the ` compiler ` defaults. This will do some initialization
@@ -123,9 +146,9 @@ If you have already built `rustc` and you change settings related to LLVM, then
123146execute ` rm -rf build ` for subsequent configuration changes to take effect. Note that `./x
124147clean` will not cause a rebuild of LLVM.
125148
126- ## Common ` x.py ` commands
149+ ## Common ` x ` commands
127150
128- Here are the basic invocations of the ` x.py ` commands most commonly used when
151+ Here are the basic invocations of the ` x ` commands most commonly used when
129152working on ` rustc ` , ` std ` , ` rustdoc ` , and other tools.
130153
131154| Command | When to use it |
@@ -141,9 +164,9 @@ serious development work. In particular, `./x build` and `./x test`
141164provide many ways to compile or test a subset of the code, which can save a lot
142165of time.
143166
144- Also, note that ` x.py ` supports all kinds of path suffixes for ` compiler ` , ` library ` ,
145- and ` src/tools ` directories. So, you can simply run ` x.py test tidy ` instead of
146- ` x.py test src/tools/tidy ` . Or, ` x.py build std ` instead of ` x.py build library/std ` .
167+ Also, note that ` x ` supports all kinds of path suffixes for ` compiler ` , ` library ` ,
168+ and ` src/tools ` directories. So, you can simply run ` x test tidy ` instead of
169+ ` x test src/tools/tidy ` . Or, ` x build std ` instead of ` x build library/std ` .
147170
148171[ rust-analyzer ] : suggested.html#configuring-rust-analyzer-for-rustc
149172
@@ -156,7 +179,7 @@ Note that building will require a relatively large amount of storage space.
156179You may want to have upwards of 10 or 15 gigabytes available to build the compiler.
157180
158181Once you've created a ` config.toml ` , you are now ready to run
159- ` x.py ` . There are a lot of options here, but let's start with what is
182+ ` x ` . There are a lot of options here, but let's start with what is
160183probably the best "go to" command for building a local compiler:
161184
162185``` bash
@@ -206,7 +229,7 @@ Instead, you can just build using the bootstrap compiler.
206229./x build --stage 0 library
207230```
208231
209- If you choose the ` library ` profile when running ` x.py setup ` , you can omit ` --stage 0 ` (it's the
232+ If you choose the ` library ` profile when running ` x setup ` , you can omit ` --stage 0 ` (it's the
210233default).
211234
212235## Creating a rustup toolchain
@@ -241,7 +264,7 @@ LLVM version: 11.0
241264```
242265
243266The rustup toolchain points to the specified toolchain compiled in your ` build ` directory,
244- so the rustup toolchain will be updated whenever ` x.py build ` or ` x.py test ` are run for
267+ so the rustup toolchain will be updated whenever ` x build ` or ` x test ` are run for
245268that toolchain/stage.
246269
247270** Note:** the toolchain we've built does not include ` cargo ` . In this case, ` rustup ` will
@@ -262,7 +285,7 @@ want to build this component:
262285## Building targets for cross-compilation
263286
264287To produce a compiler that can cross-compile for other targets,
265- pass any number of ` target ` flags to ` x.py build ` .
288+ pass any number of ` target ` flags to ` x build ` .
266289For example, if your host platform is ` x86_64-unknown-linux-gnu `
267290and your cross-compilation target is ` wasm32-wasi ` , you can build with:
268291
@@ -274,7 +297,7 @@ Note that if you want the resulting compiler to be able to build crates that
274297involve proc macros or build scripts, you must be sure to explicitly build target support for the
275298host platform (in this case, ` x86_64-unknown-linux-gnu ` ).
276299
277- If you want to always build for other targets without needing to pass flags to ` x.py build ` ,
300+ If you want to always build for other targets without needing to pass flags to ` x build ` ,
278301you can configure this in the ` [build] ` section of your ` config.toml ` like so:
279302
280303``` toml
@@ -303,9 +326,9 @@ then once you have built your compiler you will be able to use it to cross-compi
303326cargo +stage1 build --target wasm32-wasi
304327```
305328
306- ## Other ` x.py ` commands
329+ ## Other ` x ` commands
307330
308- Here are a few other useful ` x.py ` commands. We'll cover some of them in detail
331+ Here are a few other useful ` x ` commands. We'll cover some of them in detail
309332in other sections:
310333
311334- Building things:
@@ -335,3 +358,5 @@ everything up then you only need to run one command!
335358
336359` rm -rf build ` works too, but then you have to rebuild LLVM, which can take
337360a long time even on fast computers.
361+
362+ [ ^ 1 ] : issue[ #1707 ] ( https://github.com/rust-lang/rustc-dev-guide/issues/1707 )
0 commit comments