Skip to content

Commit 774a201

Browse files
committed
Move some info from "Getting Started" to "How to build and run"
"Getting Started" is already *very* long; this shrinks it a bit, and puts similar info closer together.
1 parent 0307395 commit 774a201

File tree

2 files changed

+33
-84
lines changed

2 files changed

+33
-84
lines changed

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

+29-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,34 @@ If you have already built `rustc` and you change settings related to LLVM, then
5252
execute `rm -rf build` for subsequent configuration changes to take effect. Note that `./x.py
5353
clean` will not cause a rebuild of LLVM.
5454

55-
## Building the compiler
55+
## Common `x.py` commands
56+
57+
Here are the basic invocations of the `x.py` commands most commonly used when
58+
working on `rustc`, `std`, `rustdoc`, and other tools.
59+
60+
| Command | When to use it |
61+
| --- | --- |
62+
| `./x.py check` | Quick check to see if most things compile; [rust-analyzer can run this automatically for you][rust-analyzer] |
63+
| `./x.py build` | Builds `rustc`, `std`, and `rustdoc` |
64+
| `./x.py test` | Runs all tests |
65+
| `./x.py fmt` | Formats all code |
66+
67+
As written, these commands are reasonable starting points. However, there are
68+
additional options and arguments for each of them that are worth learning for
69+
serious development work. In particular, `./x.py build` and `./x.py test`
70+
provide many ways to compile or test a subset of the code, which can save a lot
71+
of time.
72+
73+
Also, note that `x.py` supports all kinds of path suffixes for `compiler`, `library`,
74+
and `src/tools` directories. So, you can simply run `x.py test tidy` instead of
75+
`x.py test src/tools/tidy`. Or, `x.py build std` instead of `x.py build library/std`.
76+
77+
[rust-analyzer]: ./building/suggested.html#configuring-rust-analyzer-for-rustc
78+
79+
See the chapters on [building](./building/how-to-build-and-run.md),
80+
[testing](./tests/intro.md), and [rustdoc](./rustdoc.md) for more details.
81+
82+
### Building the compiler
5683

5784
Note that building will require a relatively large amount of storage space.
5885
You may want to have upwards of 10 or 15 gigabytes available to build the compiler.
@@ -98,7 +125,7 @@ build. The **full** `rustc` build (what you get with `./x.py build
98125

99126
You almost never need to do this.
100127

101-
## Build specific components
128+
### Build specific components
102129

103130
If you are working on the standard library, you probably don't need to build
104131
the compiler unless you are planning to use a recently added nightly feature.

src/getting-started.md

+4-82
Original file line numberDiff line numberDiff line change
@@ -44,86 +44,9 @@ just create noise, so we ask that you be mindful of the fact that the
4444

4545
## Cloning and Building
4646

47-
### System Requirements
47+
See ["How to build and run the compiler"](./building//how-to-build-and-run.md).
4848

49-
Internet access is required.
50-
51-
The most notable software requirement is that you will need Python 2 or 3, but
52-
there are various others.
53-
54-
The following hardware is recommended.
55-
* 30GB+ of free disk space.
56-
* 8GB+ RAM
57-
* 2+ cores
58-
59-
More powerful machines will lead to much faster builds. There are various
60-
strategies to work around lesser hardware in the following chapters.
61-
62-
See [this chapter][prereqs] for more details about software and hardware prerequisites.
63-
64-
[prereqs]: ./building/prerequisites.md
65-
66-
### Cloning
67-
68-
You can just do a normal git clone:
69-
70-
```sh
71-
git clone https://github.com/rust-lang/rust.git
72-
cd rust
73-
```
74-
75-
### `x.py` Intro
76-
77-
`rustc` is a [bootstrapping] compiler, which makes it more complex than a
78-
typical Rust program. As a result, you cannot use Cargo to build it. Instead
79-
you must use the special tool `x.py`. It is used for the things Cargo is
80-
normally used for: building, testing, creating releases, formatting, etc.
81-
82-
[bootstrapping]: ./building/bootstrapping.md
83-
84-
### Configuring the compiler
85-
86-
In the top level of the repo:
87-
88-
```sh
89-
$ ./x.py setup
90-
```
91-
92-
This will do some initialization and walk you through an interactive setup to
93-
create `config.toml`, the primary configuration file.
94-
95-
See [this chapter][config] for more info about configuration.
96-
97-
[config]: ./building/how-to-build-and-run.md#create-a-configtoml
98-
99-
### Common `x.py` commands
100-
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-
104-
| Command | When to use it |
105-
| --- | --- |
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 |
110-
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
115-
of time.
116-
117-
Also, note that `x.py` supports all kinds of path suffixes for `compiler`, `library`,
118-
and `src/tools` directories. So, you can simply run `x.py test tidy` instead of
119-
`x.py test src/tools/tidy`. Or, `x.py build std` instead of `x.py build library/std`.
120-
121-
[rust-analyzer]: ./building/suggested.html#configuring-rust-analyzer-for-rustc
122-
123-
See the chapters on [building](./building/how-to-build-and-run.md),
124-
[testing](./tests/intro.md), and [rustdoc](./rustdoc.md) for more details.
125-
126-
### Contributing code to other Rust projects
49+
## Contributing code to other Rust projects
12750

12851
There are a bunch of other projects that you can contribute to outside of the
12952
`rust-lang/rust` repo, including `clippy`, `miri`, `chalk`, and many others.
@@ -132,7 +55,7 @@ These repos might have their own contributing guidelines and procedures. Many
13255
of them are owned by working groups (e.g. `chalk` is largely owned by
13356
WG-traits). For more info, see the documentation in those repos' READMEs.
13457

135-
### Other ways to contribute
58+
## Other ways to contribute
13659

13760
There are a bunch of other ways you can contribute, especially if you don't
13861
feel comfortable jumping straight into the large `rust-lang/rust` codebase.
@@ -311,8 +234,7 @@ which would also be useful in rustc development, see [The Rust Performance Book]
311234

312235
## Other Resources
313236

314-
- This guide: talks about how `rustc` works
315237
- [The t-compiler zulip][z]
316238
- [The compiler's documentation (rustdocs)](https://doc.rust-lang.org/nightly/nightly-rustc/)
317239
- [The Forge](https://forge.rust-lang.org/) has more documentation about various procedures.
318-
- `#contribute` and `#rustdoc` on [Discord](https://discord.gg/rust-lang).
240+
- `#contribute` and `#wg-rustup` on [Discord](https://discord.gg/rust-lang).

0 commit comments

Comments
 (0)