Skip to main content

rustc_middle/
lib.rs

1//! The "main crate" of the Rust compiler. This crate contains common
2//! type definitions that are used by the other crates in the rustc
3//! "family". The following are some prominent examples.
4//!
5//! - **HIR.** The "high-level (H) intermediate representation (IR)" is
6//!   defined in the [`hir`] module.
7//! - **THIR.** The "typed high-level (H) intermediate representation (IR)"
8//!   is defined in the [`thir`] module.
9//! - **MIR.** The "mid-level (M) intermediate representation (IR)" is
10//!   defined in the [`mir`] module. This module contains only the
11//!   *definition* of the MIR; the passes that transform and operate
12//!   on MIR are found in `rustc_const_eval` crate.
13//! - **Types.** The internal representation of types used in rustc is
14//!   defined in the [`ty`] module. This includes the
15//!   [**type context**][ty::TyCtxt] (or `tcx`), which is the central
16//!   context during most of compilation, containing the interners and
17//!   other things.
18//!
19//! For more information about how rustc works, see the [rustc dev guide].
20//!
21//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/
22//!
23//! # Note
24//!
25//! This API is completely unstable and subject to change.
26
27// tidy-alphabetical-start
28#![allow(internal_features)]
29#![allow(rustc::direct_use_of_rustc_type_ir)]
30#![cfg_attr(bootstrap, feature(assert_matches))]
31#![cfg_attr(doc, feature(intra_doc_pointers))]
32#![feature(allocator_api)]
33#![feature(associated_type_defaults)]
34#![feature(box_as_ptr)]
35#![feature(box_patterns)]
36#![feature(closure_track_caller)]
37#![feature(const_default)]
38#![feature(const_trait_impl)]
39#![feature(core_intrinsics)]
40#![feature(debug_closure_helpers)]
41#![feature(decl_macro)]
42#![feature(discriminant_kind)]
43#![feature(extern_types)]
44#![feature(file_buffered)]
45#![feature(gen_blocks)]
46#![feature(min_specialization)]
47#![feature(negative_impls)]
48#![feature(never_type)]
49#![feature(ptr_alignment_type)]
50#![feature(range_bounds_is_empty)]
51#![feature(rustc_attrs)]
52#![feature(sized_hierarchy)]
53#![feature(trait_alias)]
54#![feature(try_blocks)]
55#![feature(try_trait_v2)]
56#![feature(try_trait_v2_residual)]
57#![feature(try_trait_v2_yeet)]
58#![feature(type_alias_impl_trait)]
59#![feature(yeet_expr)]
60#![recursion_limit = "256"]
61// tidy-alphabetical-end
62
63#[cfg(test)]
64mod tests;
65
66#[macro_use]
67mod macros;
68
69#[macro_use]
70pub mod arena;
71
72pub mod dep_graph;
73pub mod error;
74pub mod hir;
75pub mod hooks;
76pub mod ich;
77pub mod infer;
78pub mod lint;
79pub mod metadata;
80pub mod middle;
81pub mod mir;
82pub mod mono;
83pub mod queries;
84pub mod query;
85pub mod thir;
86pub mod traits;
87pub mod ty;
88pub mod util;
89pub mod verify_ich;
90
91// Allows macros to refer to this crate as `::rustc_middle`
92extern crate self as rustc_middle;