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::diagnostic_outside_of_impl)]
30#![allow(rustc::untranslatable_diagnostic)]
31#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
32#![doc(rust_logo)]
33#![feature(allocator_api)]
34#![feature(array_windows)]
35#![feature(assert_matches)]
36#![feature(associated_type_defaults)]
37#![feature(box_as_ptr)]
38#![feature(box_patterns)]
39#![feature(closure_track_caller)]
40#![feature(core_intrinsics)]
41#![feature(coroutines)]
42#![feature(debug_closure_helpers)]
43#![feature(decl_macro)]
44#![feature(discriminant_kind)]
45#![feature(extern_types)]
46#![feature(file_buffered)]
47#![feature(if_let_guard)]
48#![feature(intra_doc_pointers)]
49#![feature(iter_from_coroutine)]
50#![feature(min_specialization)]
51#![feature(negative_impls)]
52#![feature(never_type)]
53#![feature(ptr_alignment_type)]
54#![feature(rustc_attrs)]
55#![feature(rustdoc_internals)]
56#![feature(trusted_len)]
57#![feature(try_blocks)]
58#![feature(try_trait_v2)]
59#![feature(try_trait_v2_yeet)]
60#![feature(type_alias_impl_trait)]
61#![feature(yeet_expr)]
62#![recursion_limit = "256"]
63// tidy-alphabetical-end
64
65#[cfg(test)]
66mod tests;
67
68#[macro_use]
69mod macros;
70
71#[macro_use]
72pub mod arena;
73pub mod error;
74pub mod hir;
75pub mod hooks;
76pub mod infer;
77pub mod lint;
78pub mod metadata;
79pub mod middle;
80pub mod mir;
81pub mod thir;
82pub mod traits;
83pub mod ty;
84pub mod util;
85mod values;
86
87#[macro_use]
88pub mod query;
89#[macro_use]
90pub mod dep_graph;
91
92// Allows macros to refer to this crate as `::rustc_middle`
93extern crate self as rustc_middle;
94
95rustc_fluent_macro::fluent_messages! { "../messages.ftl" }