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