3
3
The full bootstrapping process takes quite a while. Here are five suggestions
4
4
to make your life easier.
5
5
6
- ## Configuring ` rust-analyser ` for ` rustc `
6
+ ## Configuring ` rust-analyzer ` for ` rustc `
7
7
8
- ` rust-analyser ` can help you check and format your code whenever you save
9
- a file. By default, ` rust-analyser ` runs the ` cargo check ` and ` rustfmt `
8
+ ` rust-analyzer ` can help you check and format your code whenever you save
9
+ a file. By default, ` rust-analyzer ` runs the ` cargo check ` and ` rustfmt `
10
10
commands, but you can override these commands to use more adapted versions
11
11
of these tools when hacking on ` rustc ` . For example, for Visual Studio Code,
12
12
you can write:
@@ -25,13 +25,13 @@ you can write:
25
25
}
26
26
```
27
27
28
- in your ` .vscode/settings.json ` file. This will ask ` rust-analyser ` to use
28
+ in your ` .vscode/settings.json ` file. This will ask ` rust-analyzer ` to use
29
29
` x.py check ` to check the sources, and the stage 0 rustfmt to format them.
30
30
31
31
## Check, check, and check again
32
32
33
33
When doing simple refactorings, it can be useful to run ` ./x.py check `
34
- continuously. If you set up ` rust-analyser ` as described above, this will
34
+ continuously. If you set up ` rust-analyzer ` as described above, this will
35
35
be done for you every time you save a file. Here you are just checking that
36
36
the compiler can ** build** , but often that is all you need (e.g., when renaming a
37
37
method). You can then run ` ./x.py build ` when you actually need to
@@ -94,8 +94,15 @@ building the compiler on one branch will cause the old build and the
94
94
incremental compilation cache to be overwritten. One solution would be
95
95
to have multiple clones of the repository, but that would mean storing the
96
96
Git metadata multiple times, and having to update each clone individually.
97
+
97
98
Fortunately, Git has a better solution called [ worktrees] . This lets you
98
99
create multiple "working trees", which all share the same Git database.
100
+ Moreover, because all of the worktrees share the same object database,
101
+ if you update a branch (e.g. master) in any of them, you can use the new
102
+ commits from any of the worktrees. One caveat, though, is that submodules
103
+ do not get shared. They will still be cloned multiple times.
104
+
105
+ [ worktrees ] : https://git-scm.com/docs/git-worktree
99
106
100
107
Given you are inside the root directory for your rust repository, you can
101
108
create a "linked working tree" in a new "rust2" directory by running
@@ -114,8 +121,6 @@ git worktree add -b my-feature ../rust2 master
114
121
You can then use that rust2 folder as a separate workspace for modifying
115
122
and building ` rustc ` !
116
123
117
- [ worktrees ] : https://git-scm.com/docs/git-worktree
118
-
119
124
## Building with system LLVM
120
125
121
126
By default, LLVM is built from source, and that can take significant amount of
0 commit comments