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”. Some prominent examples (note that each of these modules has their own README with further details).
- HIR. The “high-level (H) intermediate representation (IR)” is
defined in the
hir
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 inrustc_const_eval
crate. - Types. The internal representation of types used in rustc is
defined in the
ty
module. This includes the type context (ortcx
), 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.
Modules§
- arena
- dep_
graph - error
- hir
- HIR datatypes. See the rustc dev guide for more info.
- hooks
- “Hooks” provide a way for
tcx
functionality to be provided by some downstream crate without everything in rustc having to depend on that crate. 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. - infer
- lint
- macros 🔒
- metadata
- middle
- mir
- MIR datatypes and passes. See the rustc dev guide for more info.
- query
- Defines the various compiler queries.
- thir
- THIR datatypes and definitions. See the rustc dev guide for more info.
- traits
- Trait Resolution. See the rustc dev guide for more information on how this works.
- ty
- Defines how the compiler represents types internally.
- util
- values 🔒
Macros§
- Trivial
Lift Impls - Trivial
Type Traversal AndLift Impls - Trivial
Type Traversal Impls - Used for types that are
Copy
and which do not care about arena allocated data (i.e., don’t need to be folded). - __
impl_ decoder_ methods - arena_
types - This higher-order macro declares a list of types which can be allocated by
Arena
. - bug
- A macro for triggering an ICE.
Calling
bug
instead of panicking will result in a nicer error message and should therefore be preferred overpanic
/unreachable
or others. - err_
exhaust - err_
inval - err_
machine_ stop - err_ub
- err_
ub_ custom - err_
ub_ format - err_
unsup - err_
unsup_ format - implement_
ty_ decoder - make_
dep_ kind_ array - parameterized_
over_ tcx - rustc_
query_ append - span_
bug - 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. - throw_
exhaust - throw_
inval - throw_
machine_ stop - throw_
ub - throw_
ub_ custom - throw_
ub_ format - throw_
unsup - throw_
unsup_ format - trivially_
parameterized_ over_ tcx
Statics§
- DEFAULT_
LOCALE_ RESOURCE - Raw content of Fluent resource for this crate, generated by
fluent_messages
macro, imported byrustc_driver
to include all crates’ resources in one bundle.