File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
src/doc/rustc-dev-guide/src Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 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
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