Skip to content
Go back

[Memo] Rustc Overview - librustc_driver

rust compiler memo

rustc

librustc_driver

main

run_compiler_with_pool

phase_1_parse_input

phase_2_configure_and_expand

Run the “early phases” of the compiler: initial cfg processing, loading compiler plugins (including those from addl_plugins), syntax expansion, secondary cfg expansion, synthesis of a test harness if one is to be provided, injection of a dependency on the standard library and prelude, and name resolution.

Returns None if we’re aborting after handling -W help.

Currently, we ignore the name resolution data structures for the purposes of dependency tracking. Instead we will run name resolution and include its output in the hash of each item, much like we do for macro expansion. In other words, the hash reflects not just its contents but the results of name resolution on those contents. Hopefully we’ll push this back at some point.

phase_2_configure_and_expand_inner

Same as phase_2_configure_and_expand, but doesn’t let you keep the resolver around

phase_3_run_analysis_passes

Run the resolution, typechecking, region checking and other miscellaneous analysis passes on the crate. Return various structures carrying the results of the analysis.

phase_4_codegen

Run the codegen backend, after which the AST and analysis can be discarded.


Share this post on:

Previous Post
[Memo] Rustc Parser
Next Post
[Memo] Distribute Rustc Flow