Skip to content

Commit 6504079

Browse files
committed
document local profiles
Signed-off-by: onur-ozkan <[email protected]>
1 parent 81436bd commit 6504079

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

src/doc/rustc-dev-guide/src/building/suggested.md

+44
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,50 @@ your `.git/hooks` folder as `pre-push` (without the `.sh` extension!).
2020

2121
You can also install the hook as a step of running `./x setup`!
2222

23+
## Local bootstrap profiles
24+
25+
When working on different tasks, you might need to switch between different bootstrap configurations.
26+
Sometimes you may want to keep an old configuration for future use. But saving raw config values in
27+
random files and manually copying and pasting them can quickly become messy, especially if you have a
28+
long history of different configurations.
29+
30+
To simplify managing multiple configurations, you can create local profiles and switch between them easily.
31+
32+
For example, you can create `cross` profile by creating `cross.toml` file this:
33+
34+
```toml
35+
[build]
36+
build = "x86_64-unknown-linux-gnu"
37+
host = ["i686-unknown-linux-gnu"]
38+
target = ["i686-unknown-linux-gnu"]
39+
40+
41+
[llvm]
42+
download-ci-llvm = false
43+
44+
[target.x86_64-unknown-linux-gnu]
45+
llvm-config = "/path/to/llvm-19/bin/llvm-config"
46+
```
47+
48+
Then, use this profile in your `bootstrap.toml`:
49+
50+
```toml
51+
profile = "cross"
52+
```
53+
54+
You can also define recursive profiles, meaning that local profiles can inherit other profiles.
55+
56+
For example, you can:
57+
58+
1. Create `some-config1` profile in `some-config1.toml`.
59+
2. Create `some-config2` profile in `some-config2.toml` and inherit `some-config1`.
60+
3. Create `some-config3` profile in `some-config3.toml` and inherit `some-config2`.
61+
4. ...
62+
63+
You can chain profiles like this as deep as you need without any limitations.
64+
65+
Note: The outer configuration file always overrides the inner one.
66+
2367
## Configuring `rust-analyzer` for `rustc`
2468

2569
### Project-local rust-analyzer setup

0 commit comments

Comments
 (0)