Skip to content

Commit 1468006

Browse files
committed
adding links
1 parent 9835874 commit 1468006

File tree

1 file changed

+28
-29
lines changed

1 file changed

+28
-29
lines changed

src/compiler-src.md

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- toc -->
44

55
Now that we have [seen what the compiler does][orgch], let's take a
6-
look at the structure of the [`rust-lang/rust`] repository, where the rustc
6+
look at the structure of the [`rust-lang/rust`] repository, where the `rustc`
77
source code lives.
88

99
[`rust-lang/rust`]: https://github.com/rust-lang/rust
@@ -54,8 +54,8 @@ The repository consists of three main directories:
5454

5555
## Compiler
5656

57-
The compiler is implemented in the various `compiler/` crates.
58-
The `compiler/` crates all have names starting with `rustc_*`. These are a
57+
The compiler is implemented in the various [`compiler/`] crates.
58+
The [`compiler/`] crates all have names starting with `rustc_*`. These are a
5959
collection of around 50 interdependent crates ranging in size from tiny to
6060
huge. There is also the `rustc` crate which is the actual binary (i.e. the
6161
`main` function); it doesn't actually do anything besides calling the
@@ -120,13 +120,13 @@ by the whole compiler (e.g. [`rustc_span`]). The very early parts of the
120120
compilation process (e.g. [parsing and the Abstract Syntax Tree (`AST`)][parser])
121121
depend on only these.
122122

123-
After the `AST` is constructed and other early analysis is done, the compiler's
124-
[query system][query] gets set up. The query system is set up in a clever way
125-
using function pointers. This allows us to break dependencies between crates,
126-
allowing more parallel compilation. The query system is defined in
127-
[`rustc_middle`], so nearly all subsequent parts of the compiler depend on this
128-
crate. It is a really large crate, leading to long compile times. Some efforts
129-
have been made to move stuff out of it with varying success. Another
123+
After the [`AST`][parser] is constructed and other early analysis is done, the
124+
compiler's [query system][query] gets set up. The query system is set up in a
125+
clever way using function pointers. This allows us to break dependencies
126+
between crates, allowing more parallel compilation. The query system is defined
127+
in [`rustc_middle`], so nearly all subsequent parts of the compiler depend on
128+
this crate. It is a really large crate, leading to long compile times. Some
129+
efforts have been made to move stuff out of it with varying success. Another
130130
side-effect is that sometimes related functionality gets scattered across
131131
different crates. For example, linting functionality is found across earlier
132132
parts of the crate, [`rustc_lint`], [`rustc_middle`], and other places.
@@ -139,7 +139,7 @@ so breaking things into separate crates has been our solution so far.
139139
At the top of the dependency tree is [`rustc_driver`] and [`rustc_interface`]
140140
which is an unstable wrapper around the query system helping drive various
141141
stages of compilation. Other consumers of the compiler may use this interface
142-
in different ways (e.g. `rustdoc` or maybe eventually `rust-analyzer`). The
142+
in different ways (e.g. [`rustdoc`] or maybe eventually `rust-analyzer`). The
143143
[`rustc_driver`] crate first parses command line arguments and then uses
144144
[`rustc_interface`] to drive the compilation to completion.
145145

@@ -149,57 +149,56 @@ in different ways (e.g. `rustdoc` or maybe eventually `rust-analyzer`). The
149149

150150
## rustdoc
151151

152-
The bulk of `rustdoc` is in [`librustdoc`]. However, the `rustdoc` binary
152+
The bulk of [`rustdoc`] is in [`librustdoc`]. However, the [`rustdoc`] binary
153153
itself is [`src/tools/rustdoc`], which does nothing except call [`rustdoc::main`].
154154

155155
There is also `JavaScript` and `CSS` for the docs in [`src/tools/rustdoc-js`]
156156
and [`src/tools/rustdoc-themes`].
157157

158-
You can read more about `rustdoc` in [this chapter][rustdocch].
158+
You can read more about [`rustdoc`] in [this chapter][`rustdoc`].
159159

160160
[`librustdoc`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/index.html
161161
[`rustdoc::main`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/fn.main.html
162162
[`src/tools/rustdoc-js`]: https://github.com/rust-lang/rust/tree/master/src/tools/rustdoc-js
163163
[`src/tools/rustdoc-themes`]: https://github.com/rust-lang/rust/tree/master/src/tools/rustdoc-themes
164164
[`src/tools/rustdoc`]: https://github.com/rust-lang/rust/tree/master/src/tools/rustdoc
165-
[rustdocch]: ./rustdoc.md
165+
[`rustdoc`]: ./rustdoc.md
166166

167167
## Tests
168168

169169
The test suite for all of the above is in [`tests/`]. You can read more
170170
about the test suite [in this chapter][testsch].
171171

172-
The test harness is in [`src/tools/compiletest`].
172+
The test harness is in [`src/tools/compiletest/`][`compiletest/`].
173173

174-
[`src/tools/compiletest`]: https://github.com/rust-lang/rust/tree/master/src/tools/compiletest
175174
[`tests/`]: https://github.com/rust-lang/rust/tree/master/tests
176175
[testsch]: ./tests/intro.md
177176

178177
## Build System
179178

180179
There are a number of tools in the repository just for building the compiler,
181-
standard library, `rustdoc`, etc, along with testing, building a full Rust
180+
standard library, [`rustdoc`], etc, along with testing, building a full Rust
182181
distribution, etc.
183182

184-
One of the primary tools is [`src/bootstrap`]. You can read more about
183+
One of the primary tools is [`src/bootstrap/`]. You can read more about
185184
bootstrapping [in this chapter][bootstch]. The process may also use other tools
186-
from [`src/tools/`], such as [`tidy`] or [`compiletest`].
185+
from [`src/tools/`], such as [`tidy/`] or [`compiletest/`].
187186

188-
[`compiletest`]: https://github.com/rust-lang/rust/tree/master/src/tools/compiletest
189-
[`src/bootstrap`]: https://github.com/rust-lang/rust/tree/master/src/bootstrap
187+
[`compiletest/`]: https://github.com/rust-lang/rust/tree/master/src/tools/compiletest
188+
[`src/bootstrap/`]: https://github.com/rust-lang/rust/tree/master/src/bootstrap
190189
[`src/tools/`]: https://github.com/rust-lang/rust/tree/master/src/tools
191-
[`tidy`]: https://github.com/rust-lang/rust/tree/master/src/tools/tidy
190+
[`tidy/`]: https://github.com/rust-lang/rust/tree/master/src/tools/tidy
192191
[bootstch]: ./building/bootstrapping.md
193192

194-
## Standard library (`libstd`)
195-
196-
The standard library crates are all in `library/`. They have intuitive names
197-
like `std`, `core`, `alloc`, etc. There is also `proc_macro`, `test`, and
198-
other runtime libraries. The standard library is sometimes referred to as
199-
`libstd`.
193+
## Standard library (`std`)
200194

201195
This code is fairly similar to most other Rust crates except that it must be
202-
built in a special way because it can use unstable (`nightly`) features.
196+
built in a special way because it can use unstable ([`nightly`]) features. The
197+
standard library is sometimes referred to as [`libstd or the "standard
198+
facade"`].
199+
200+
[`libstd or the "standard facade"`]: https://rust-lang.github.io/rfcs/0040-libstd-facade.html
201+
[`nightly`]: https://doc.rust-lang.org/nightly/nightly-rustc/
203202

204203
## Other
205204

0 commit comments

Comments
 (0)