Skip to content

Commit 24132fa

Browse files
authored
Unify x.py usage (#1258)
1 parent 0fc1fa9 commit 24132fa

13 files changed

+56
-56
lines changed

src/backend/updating-llvm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ through each in detail.
102102
with updated LLVM bindings. Note that you should use `#ifdef` and such to ensure
103103
that the bindings still compile on older LLVM versions.
104104

105-
Note that `profile = "compiler"` and other defaults set by `x.py setup`
105+
Note that `profile = "compiler"` and other defaults set by `./x.py setup`
106106
download LLVM from CI instead of building it from source. You should
107107
disable this temporarily to make sure your changes are being used, by setting
108108
```toml

src/building/bootstrapping.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ However, it takes a very long time to build
5555
because one must first build the new compiler with an older compiler
5656
and then use that to build the new compiler with itself.
5757
For development, you usually only want the `stage1` compiler,
58-
which you can build with `x.py build library/std`.
58+
which you can build with `./x.py build library/std`.
5959
See [Building the Compiler](/building/how-to-build-and-run.html#building-the-compiler).
6060

6161
### Stage 3
@@ -157,26 +157,26 @@ Build artifacts include, but are not limited to:
157157

158158
#### Examples
159159

160-
- `x.py build --stage 0` means to build with the beta `rustc`.
161-
- `x.py doc --stage 0` means to document using the beta `rustdoc`.
162-
- `x.py test --stage 0 library/std` means to run tests on the standard library
160+
- `./x.py build --stage 0` means to build with the beta `rustc`.
161+
- `./x.py doc --stage 0` means to document using the beta `rustdoc`.
162+
- `./x.py test --stage 0 library/std` means to run tests on the standard library
163163
without building `rustc` from source ('build with stage 0, then test the
164164
artifacts'). If you're working on the standard library, this is normally the
165165
test command you want.
166-
- `x.py test src/test/ui` means to build the stage 1 compiler and run
166+
- `./x.py test src/test/ui` means to build the stage 1 compiler and run
167167
`compiletest` on it. If you're working on the compiler, this is normally the
168168
test command you want.
169169

170170
#### Examples of what *not* to do
171171

172-
- `x.py test --stage 0 src/test/ui` is not meaningful: it runs tests on the
172+
- `./x.py test --stage 0 src/test/ui` is not meaningful: it runs tests on the
173173
_beta_ compiler and doesn't build `rustc` from source. Use `test src/test/ui`
174174
instead, which builds stage 1 from source.
175-
- `x.py test --stage 0 compiler/rustc` builds the compiler but runs no tests:
175+
- `./x.py test --stage 0 compiler/rustc` builds the compiler but runs no tests:
176176
it's running `cargo test -p rustc`, but cargo doesn't understand Rust's
177177
tests. You shouldn't need to use this, use `test` instead (without arguments).
178-
- `x.py build --stage 0 compiler/rustc` builds the compiler, but does not build
179-
libstd or even libcore. Most of the time, you'll want `x.py build
178+
- `./x.py build --stage 0 compiler/rustc` builds the compiler, but does not build
179+
libstd or even libcore. Most of the time, you'll want `./x.py build
180180
library/std` instead, which allows compiling programs without needing to define
181181
lang items.
182182

@@ -348,7 +348,7 @@ You can find more discussion about sysroots in:
348348

349349
[rustdoc PR]: https://github.com/rust-lang/rust/pull/76728
350350

351-
### Directories and artifacts generated by x.py
351+
### Directories and artifacts generated by `x.py`
352352

353353
The following tables indicate the outputs of various stage actions:
354354

src/building/build-install-distribution-artifacts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ test that it works on your target system. You’ll want to run this command:
1818

1919
Note: If you are testing out a modification to a compiler, you
2020
might want to use it to compile some project.
21-
Usually, you do not want to use ./x.py install for testing.
21+
Usually, you do not want to use `./x.py install` for testing.
2222
Rather, you should create a toolchain as discussed in
2323
[here][create-rustup-toolchain].
2424

src/building/compiler-documenting.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ You might want to build documentation of the various components
44
available like the standard library. There’s two ways to go about this.
55
You can run rustdoc directly on the file to make sure the HTML is
66
correct, which is fast. Alternatively, you can build the documentation
7-
as part of the build process through x.py. Both are viable methods
7+
as part of the build process through `x.py`. Both are viable methods
88
since documentation is more about the content.
99

1010
## Document everything

src/building/how-to-build-and-run.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ cd rust
2020

2121
## Create a `config.toml`
2222

23-
To start, run `x.py setup`. This will create a `config.toml` with reasonable defaults.
23+
To start, run `./x.py setup`. This will create a `config.toml` with reasonable defaults.
2424

2525
You may also want to change some of the following settings (and possibly others, such as
2626
`llvm.ccache`):

src/building/new-target.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ relevant to your desired goal.
88

99
For very new targets, you may need to use a different fork of LLVM
1010
than what is currently shipped with Rust. In that case, navigate to
11-
the `src/llvm-project` git submodule (you might need to run `x.py
11+
the `src/llvm-project` git submodule (you might need to run `./x.py
1212
check` at least once so the submodule is updated), check out the
1313
appropriate commit for your fork, then commit that new submodule
1414
reference in the main Rust repository.

src/building/suggested.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ to make your life easier.
88
CI will automatically fail your build if it doesn't pass `tidy`, our
99
internal tool for ensuring code quality. If you'd like, you can install a
1010
[Git hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks)
11-
that will automatically run `x.py test tidy --bless` on each commit, to ensure
11+
that will automatically run `./x.py test tidy --bless` on each commit, to ensure
1212
your code is up to par. If you decide later that this behavior is
1313
undesirable, you can delete the `pre-commit` file in `.git/hooks`.
1414

1515
A prebuilt git hook lives at [`src/etc/pre-commit.sh`](https://github.com/rust-lang/rust/blob/master/src/etc/pre-commit.sh) which can be copied into your `.git/hooks` folder as `pre-commit` (without the `.sh` extension!).
1616

17-
You can also install the hook as a step of running `x.py setup`!
17+
You can also install the hook as a step of running `./x.py setup`!
1818

1919
## Configuring `rust-analyzer` for `rustc`
2020

@@ -43,7 +43,7 @@ you can write: <!-- date: 2021-09 --><!-- the date comment is for the edition be
4343
```
4444

4545
in your `.vscode/settings.json` file. This will ask `rust-analyzer` to use
46-
`x.py check` to check the sources, and the stage 0 rustfmt to format them.
46+
`./x.py check` to check the sources, and the stage 0 rustfmt to format them.
4747

4848
> NOTE: Make sure to replace `TARGET_TRIPLE` in the `rust-analyzer.rustfmt.overrideCommand`
4949
> setting with the appropriate target triple for your machine. An example of such
@@ -55,7 +55,7 @@ If you're running `coc.nvim`, you can use `:CocLocalConfig` to create a
5555
`editor.formatOnSave: true,` with
5656
`"coc.preferences.formatOnSaveFiletypes": ["rust"],`.
5757

58-
If running `x.py check` on save is inconvenient, in VS Code you can use a [Build
58+
If running `./x.py check` on save is inconvenient, in VS Code you can use a [Build
5959
Task] instead:
6060

6161
```JSON

src/contributing.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ of the status of a particular pull request.
9797
Rust has plenty of CI capacity, and you should never have to worry about wasting
9898
computational resources each time you push a change. It is also perfectly fine
9999
(and even encouraged!) to use the CI to test your changes if it can help your
100-
productivity. In particular, we don't recommend running the full `x.py test` suite locally,
100+
productivity. In particular, we don't recommend running the full `./x.py test` suite locally,
101101
since it takes a very long time to execute.
102102

103103
After someone has reviewed your pull request, they will leave an annotation
@@ -173,32 +173,32 @@ differently from other crates that are directly in this repo:
173173
* [rustfmt](https://github.com/rust-lang/rustfmt)
174174

175175
In contrast to `submodule` dependencies
176-
(see below for those), the `subtree` dependencies are just regular files and directories which can
177-
be updated in tree. However, enhancements, bug fixes, etc. specific to these tools should be filed
176+
(see below for those), the `subtree` dependencies are just regular files and directories which can
177+
be updated in tree. However, enhancements, bug fixes, etc. specific to these tools should be filed
178178
against the tools directly in their respective upstream repositories.
179179

180180
#### Synchronizing a subtree
181181

182-
Periodically the changes made to subtree based dependencies need to be synchronized between this
182+
Periodically the changes made to subtree based dependencies need to be synchronized between this
183183
repository and the upstream tool repositories.
184184

185-
Subtree synchronizations are typically handled by the respective tool maintainers. Other users
186-
are welcome to submit synchronization PRs, however, in order to do so you you will need to modify
187-
your local git installation and follow a very precise set of instructions.
188-
These instructions are documented, along with several useful tips and tricks, in the
189-
[syncing subtree changes][clippy-sync-docs] section in Clippy's Contributing guide.
190-
The instructions are applicable for use with any subtree based tool, just be sure to
191-
use the correct corresponding subtree directory and remote repository.
185+
Subtree synchronizations are typically handled by the respective tool maintainers. Other users
186+
are welcome to submit synchronization PRs, however, in order to do so you you will need to modify
187+
your local git installation and follow a very precise set of instructions.
188+
These instructions are documented, along with several useful tips and tricks, in the
189+
[syncing subtree changes][clippy-sync-docs] section in Clippy's Contributing guide.
190+
The instructions are applicable for use with any subtree based tool, just be sure to
191+
use the correct corresponding subtree directory and remote repository.
192192

193193
The synchronization process goes in two directions: `subtree push` and `subtree pull`.
194194

195-
A `subtree push` takes all the changes that happened to the copy in this repo and creates commits
196-
on the remote repo that match the local changes. Every local
197-
commit that touched the subtree causes a commit on the remote repo, but
195+
A `subtree push` takes all the changes that happened to the copy in this repo and creates commits
196+
on the remote repo that match the local changes. Every local
197+
commit that touched the subtree causes a commit on the remote repo, but
198198
is modified to move the files from the specified directory to the tool repo root.
199199

200-
A `subtree pull` takes all changes since the last `subtree pull`
201-
from the tool repo and adds these commits to the rustc repo along with a merge commit that moves
200+
A `subtree pull` takes all changes since the last `subtree pull`
201+
from the tool repo and adds these commits to the rustc repo along with a merge commit that moves
202202
the tool changes into the specified directory in the rust repository.
203203

204204
It is recommended that you always do a push first and get that merged to the tool master branch.

src/getting-started.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ this chapter for more info][config].
128128
In the top level of the repo:
129129

130130
```sh
131-
$ x.py setup
131+
$ ./x.py setup
132132
```
133133

134-
This will walk you through an interactive setup for x.py that looks like this:
134+
This will walk you through an interactive setup for `x.py` that looks like this:
135135

136136
```
137-
$ x.py setup
137+
$ ./x.py setup
138138
Welcome to the Rust project! What do you want to do with x.py?
139139
a) Contribute to the standard library
140140
b) Contribute to the compiler
@@ -150,13 +150,13 @@ To get started, try one of the following commands:
150150
For more suggestions, see https://rustc-dev-guide.rust-lang.org/building/suggested.html
151151
```
152152

153-
Note that by default, `x.py setup` will use CI-built LLVM if available for your
153+
Note that by default, `./x.py setup` will use CI-built LLVM if available for your
154154
platform so that you don't need to build LLVM in addition to building the
155155
compiler. In some circumstances, such as when updating the version of LLVM used
156156
by `rustc`, you may want to temporarily disable this feature. See the ["Updating
157157
LLVM" section] for more.
158158

159-
If you want to download LLVM from CI without running `x.py setup`, you can set
159+
If you want to download LLVM from CI without running `./x.py setup`, you can set
160160
the `download-ci-llvm` option to `true` in your `config.toml`:
161161

162162
```toml
@@ -166,7 +166,7 @@ download-ci-llvm = true
166166

167167
["Updating LLVM" section]: https://rustc-dev-guide.rust-lang.org/backend/updating-llvm.html?highlight=download-ci-llvm#feature-updates
168168

169-
### x.py Intro
169+
### `x.py` Intro
170170

171171
`rustc` is a _bootstrapping_ compiler, which means that it is written in Rust
172172
and thus needs to be compiled by itself. So where do you
@@ -177,7 +177,7 @@ to build a new compiler. Then, we use that compiler to build itself. Thus,
177177

178178
[boot]: ./building/bootstrapping.md
179179

180-
We have a special tool `./x.py` that drives this process. It is used for
180+
We have a special tool `x.py` that drives this process. It is used for
181181
building the compiler, the standard libraries, and `rustdoc`. It is also used
182182
for driving CI and building the final release artifacts.
183183

@@ -195,14 +195,14 @@ should still read the rest of the section:
195195

196196
| Command | When to use it |
197197
| --- | --- |
198-
| `x.py check` | Quick check to see if things compile; [rust-analyzer can run this automatically for you][rust-analyzer] |
199-
| `x.py build --stage 0 [library/std]` | Build only the standard library, without building the compiler |
200-
| `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 |
201-
| `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.) |
202-
| `x.py test [--keep-stage 1]` | Run the test suite using the stage1 compiler |
203-
| `x.py test --bless [--keep-stage 1]` | Run the test suite using the stage1 compiler _and_ update expected test output. |
204-
| `x.py build --stage 2 compiler/rustc` | Do a full 2-stage build. You almost never want to do this. |
205-
| `x.py test --stage 2` | Do a full 2-stage build and run all tests. You almost never want to do this. |
198+
| `./x.py check` | Quick check to see if things compile; [rust-analyzer can run this automatically for you][rust-analyzer] |
199+
| `./x.py build --stage 0 [library/std]` | Build only the standard library, without building the compiler |
200+
| `./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 |
201+
| `./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.) |
202+
| `./x.py test [--keep-stage 1]` | Run the test suite using the stage1 compiler |
203+
| `./x.py test --bless [--keep-stage 1]` | Run the test suite using the stage1 compiler _and_ update expected test output. |
204+
| `./x.py build --stage 2 compiler/rustc` | Do a full 2-stage build. You almost never want to do this. |
205+
| `./x.py test --stage 2` | Do a full 2-stage build and run all tests. You almost never want to do this. |
206206

207207
To do a full 2-stage build of the whole compiler, you should run this (after
208208
updating `config.toml` as mentioned above):
@@ -231,7 +231,7 @@ For most contributions, you only need to build stage 1, which saves a lot of tim
231231
```
232232

233233
This will take a while, especially the first time. Be wary of accidentally
234-
touching or formatting the compiler, as `./x.py` will try to recompile it.
234+
touching or formatting the compiler, as `x.py` will try to recompile it.
235235

236236
**NOTE**: The `--keep-stage 1` will _assume_ that the stage 0 standard library
237237
does not need to be rebuilt, which is usually true, which will save some time.

src/git.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ These changes are not changes to files: they are changes to submodules (more on
158158
this [later](#git-submodules)). To get rid of those, run `git submodule update`
159159
(or run any `x.py` command, which will automatically update the submodules).
160160
Note that there is (as of <!-- date: 2021-07 --> July 2021) a [bug][#77620] if you use
161-
worktrees, submodules, and x.py in a commit hook. If you run into an error
161+
worktrees, submodules, and `x.py` in a commit hook. If you run into an error
162162
like:
163163

164164
```

src/profiling.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ extension in LLVM bitcode format.
4444
Example usage:
4545
```
4646
cargo install cargo-llvm-lines
47-
# On a normal crate you could now run `cargo llvm-lines`, but x.py isn't normal :P
47+
# On a normal crate you could now run `cargo llvm-lines`, but `x.py` isn't normal :P
4848
4949
# Do a clean before every run, to not mix in the results from previous runs.
5050
./x.py clean
@@ -88,7 +88,7 @@ Example output for the compiler:
8888
326903 (0.7%) 642 (0.0%) rustc_query_system::query::plumbing::try_execute_query
8989
```
9090

91-
Since this doesn't seem to work with incremental compilation or `x.py check`,
91+
Since this doesn't seem to work with incremental compilation or `./x.py check`,
9292
you will be compiling rustc _a lot_.
9393
I recommend changing a few settings in `config.toml` to make it bearable:
9494
```

src/tests/intro.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- toc -->
44

55
The Rust project runs a wide variety of different tests, orchestrated by
6-
the build system (`x.py test`). The main test harness for testing the
6+
the build system (`./x.py test`). The main test harness for testing the
77
compiler itself is a tool called compiletest (located in the
88
[`src/tools/compiletest`] directory). This section gives a brief
99
overview of how the testing framework is setup, and then gets into some

src/tests/running.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ with the debuginfo test suite:
4949
```
5050

5151
If you only need to test a specific subdirectory of tests for any
52-
given test suite, you can pass that directory to `x.py test`:
52+
given test suite, you can pass that directory to `./x.py test`:
5353

5454
```bash
5555
./x.py test src/test/ui/const-generics

0 commit comments

Comments
 (0)