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