rustc_middle - Rust (original) (raw)
Expand description
The “main crate” of the Rust compiler. This crate contains common type definitions that are used by the other crates in the rustc “family”. The following are some prominent examples.
- HIR. The “high-level (H) intermediate representation (IR)” is defined in the hir module.
- THIR. The “typed high-level (H) intermediate representation (IR)” is defined in the thir module.
- MIR. The “mid-level (M) intermediate representation (IR)” is defined in the mir module. This module contains only the_definition_ of the MIR; the passes that transform and operate on MIR are found in
rustc_const_eval
crate. - Types. The internal representation of types used in rustc is defined in the ty module. This includes thetype context (or
tcx
), which is the central context during most of compilation, containing the interners and other things.
For more information about how rustc works, see the rustc dev guide.
§Note
This API is completely unstable and subject to change.
HIR datatypes. See the rustc dev guide for more info.
“Hooks” let you write tcx
methods in downstream crates and call them in this crate, reducing the amount of code that needs to be in this crate (which is already very big). This is somewhat similar to queries, but queries come with a lot of machinery for caching and incremental compilation, whereas hooks are just plain function pointers without any of the query magic.
macros 🔒
MIR datatypes and passes. See the rustc dev guide for more info.
Defines the various compiler queries.
THIR datatypes and definitions. See the rustc dev guide for more info.
Trait Resolution. See the rustc dev guide for more information on how this works.
Defines how the compiler represents types internally.
values 🔒
This higher-order macro declares a list of types which can be allocated by Arena
.
A macro for triggering an ICE. Calling bug
instead of panicking will result in a nicer error message and should therefore be preferred over panic
/unreachable
or others.
Higher-order macro that invokes the specified macro with a prepared list of all query signatures (including modifiers).
A macro for triggering an ICE with a span. Calling span_bug!
instead of panicking will result in a nicer error message and point at the code the compiler was compiling when it ICEd. This is the preferred way to trigger ICEs.
trivially_parameterized_over_tcx
Raw content of Fluent resource for this crate, generated by fluent_messages
macro, imported by rustc_driver
to include all crates’ resources in one bundle.