What is the relation between rustc_middle's modules and the corresponding crates?

In the source code of Rust, there is a crate rustc_middle, which contains hir, mir modules. Meanwhile, there are rustc_hir, rustc_mir crates in Rust source code. What is the relation between these modules and crates?

You might find The Guide to Rustc Development useful here.

In particular, the chapter on MIR says:

MIR is defined in the compiler/rustc_middle/src/mir/ module, but much of the code that manipulates it is found in compiler/rustc_mir .

So it sounds like rustc_middle contains the definition for MIR so other crates can depend on it and the analysis is done elsewhere.

On the other hand, rustc_middle::hir looks like it just contains some odds and ends while rustc_hir contains the bulk of the IR types.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.