You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cohesive crates, with incremental and parallel compilation making sure compile
134
-
times stay reasonable. However, incremental and parallel compilation haven't
135
-
gotten good enough for that yet, so breaking things into separate crates has
136
-
been our solution so far.
120
+
compilation process (e.g. [parsing and the Abstract Syntax Tree (`AST`)][parser])
121
+
depend on only these.
122
+
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 side-effect is that sometimes related functionality gets scattered across different
130
+
crates. For example, linting functionality is found across earlier parts of the
131
+
crate, [`rustc_lint`], [`rustc_middle`], and other places.
132
+
133
+
Ideally there would be fewer, more cohesive crates, with incremental and
134
+
parallel compilation making sure compile times stay reasonable. However,
135
+
incremental and parallel compilation haven't gotten good enough for that yet,
136
+
so breaking things into separate crates has been our solution so far.
137
137
138
138
At the top of the dependency tree is [`rustc_driver`] and [`rustc_interface`]
139
139
which is an unstable wrapper around the query system helping drive various
@@ -142,15 +142,16 @@ in different ways (e.g. `rustdoc` or maybe eventually `rust-analyzer`). The
142
142
[`rustc_driver`] crate first parses command line arguments and then uses
143
143
[`rustc_interface`] to drive the compilation to completion.
0 commit comments