Skip to content

Commit 02c037e

Browse files
authored
Merge pull request #19212 from lnicola/sync-from-rust
minor: sync from downstream
2 parents 5593179 + caeaa14 commit 02c037e

File tree

4 files changed

+36
-3
lines changed

4 files changed

+36
-3
lines changed

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
- [Prologue](./building/bootstrapping/intro.md)
7676
- [What Bootstrapping does](./building/bootstrapping/what-bootstrapping-does.md)
7777
- [How Bootstrap does it](./building/bootstrapping/how-bootstrap-does-it.md)
78+
- [Writing tools in Bootstrap](./building/bootstrapping/writing-tools-in-bootstrap.md)
7879
- [Debugging bootstrap](./building/bootstrapping/debugging-bootstrap.md)
7980

8081
# High-level Compiler Architecture
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Writing tools in Bootstrap
2+
3+
There are three types of tools you can write in bootstrap:
4+
5+
- **`Mode::ToolBootstrap`**
6+
Use this for tools that don’t need anything from the in-tree compiler and can run with the stage0 `rustc`.
7+
The output is placed in the "stage0-bootstrap-tools" directory. This mode is for general-purpose tools built
8+
entirely with the stage0 compiler, including target libraries and only works for stage 0.
9+
10+
- **`Mode::ToolStd`**
11+
Use this for tools that rely on the locally built std. The output goes into the "stageN-tools" directory.
12+
This mode is rarely used, mainly for `compiletest` which requires `libtest`.
13+
14+
- **`Mode::ToolRustc`**
15+
Use this for tools that depend on both the locally built `rustc` and the target `std`. This is more complex than
16+
the other modes because the tool must be built with the same compiler used for `rustc` and placed in the "stageN-tools"
17+
directory. When you choose `Mode::ToolRustc`, `ToolBuild` implementation takes care of this automatically.
18+
If you need to use the builder’s compiler for something specific, you can get it from `ToolBuildResult`, which is
19+
returned by the tool's [`Step`].
20+
21+
Regardless of the tool type you must return `ToolBuildResult` from the tool’s [`Step`] implementation and use `ToolBuild` inside it.
22+
23+
[`Step`]: https://doc.rust-lang.org/nightly/nightly-rustc/bootstrap/core/builder/trait.Step.html

src/building/suggested.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,16 @@ You can run `./x setup editor` and select `helix`, which will prompt you to
154154
create `languages.toml` with the recommended configuration for Helix. The
155155
recommended settings live at [`src/etc/rust_analyzer_helix.toml`].
156156

157+
### Zed
158+
159+
Zed comes with built-in LSP and rust-analyzer support.
160+
It can be configured through `.zed/settings.json`, as described
161+
[here](https://zed.dev/docs/configuring-languages). Selecting `zed`
162+
in `./x setup editor` will prompt you to create a `.zed/settings.json`
163+
file which will configure Zed with the recommended configuration. The
164+
recommended `rust-analyzer` settings live
165+
at [`src/etc/rust_analyzer_zed.json`].
166+
157167
## Check, check, and check again
158168

159169
When doing simple refactoring, it can be useful to run `./x check`
@@ -381,4 +391,5 @@ load this completion.
381391
[`src/etc/rust_analyzer_settings.json`]: https://github.com/rust-lang/rust/blob/master/src/etc/rust_analyzer_settings.json
382392
[`src/etc/rust_analyzer_eglot.el`]: https://github.com/rust-lang/rust/blob/master/src/etc/rust_analyzer_eglot.el
383393
[`src/etc/rust_analyzer_helix.toml`]: https://github.com/rust-lang/rust/blob/master/src/etc/rust_analyzer_helix.toml
394+
[`src/etc/rust_analyzer_zed.json`]: https://github.com/rust-lang/rust/blob/master/src/etc/rust_analyzer_zed.json
384395
[`src/etc/pre-push.sh`]: https://github.com/rust-lang/rust/blob/master/src/etc/pre-push.sh

src/implementing_new_features.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,7 @@ a new unstable feature:
167167

168168
1. Prevent usage of the new feature unless the feature gate is set.
169169
You can check it in most places in the compiler using the
170-
expression `tcx.features().$feature_name` (or
171-
`sess.features_untracked().$feature_name` if the
172-
tcx is unavailable)
170+
expression `tcx.features().$feature_name()`
173171

174172
If the feature gate is not set, you should either maintain
175173
the pre-feature behavior or raise an error, depending on

0 commit comments

Comments
 (0)