File tree 2 files changed +24
-0
lines changed
src/doc/rustc-dev-guide/src
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 75
75
- [ Prologue] ( ./building/bootstrapping/intro.md )
76
76
- [ What Bootstrapping does] ( ./building/bootstrapping/what-bootstrapping-does.md )
77
77
- [ How Bootstrap does it] ( ./building/bootstrapping/how-bootstrap-does-it.md )
78
+ - [ Writing tools in Bootstrap] ( ./building/bootstrapping/writing-tools-in-bootstrap.md )
78
79
- [ Debugging bootstrap] ( ./building/bootstrapping/debugging-bootstrap.md )
79
80
80
81
# High-level Compiler Architecture
Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments