]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_middle/src/lib.rs
cfg-step code
[rust.git] / compiler / rustc_middle / src / 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". Some prominent examples (note that each of these modules
4 //! has their own README with further details).
5 //!
6 //! - **HIR.** The "high-level (H) intermediate representation (IR)" is
7 //!   defined in the `hir` module.
8 //! - **MIR.** The "mid-level (M) intermediate representation (IR)" is
9 //!   defined in the `mir` module. This module contains only the
10 //!   *definition* of the MIR; the passes that transform and operate
11 //!   on MIR are found in `rustc_const_eval` crate.
12 //! - **Types.** The internal representation of types used in rustc is
13 //!   defined in the `ty` module. This includes the **type context**
14 //!   (or `tcx`), which is the central context during most of
15 //!   compilation, containing the interners and other things.
16 //!
17 //! For more information about how rustc works, see the [rustc dev guide].
18 //!
19 //! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/
20 //!
21 //! # Note
22 //!
23 //! This API is completely unstable and subject to change.
24
25 #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
26 #![feature(allocator_api)]
27 #![feature(array_windows)]
28 #![feature(assert_matches)]
29 #![feature(box_patterns)]
30 #![feature(core_intrinsics)]
31 #![feature(discriminant_kind)]
32 #![feature(exhaustive_patterns)]
33 #![feature(get_mut_unchecked)]
34 #![feature(if_let_guard)]
35 #![feature(negative_impls)]
36 #![feature(never_type)]
37 #![feature(extern_types)]
38 #![feature(new_uninit)]
39 #![feature(once_cell)]
40 #![feature(let_chains)]
41 #![feature(min_specialization)]
42 #![feature(trusted_len)]
43 #![feature(type_alias_impl_trait)]
44 #![feature(associated_type_bounds)]
45 #![feature(rustc_attrs)]
46 #![feature(control_flow_enum)]
47 #![feature(associated_type_defaults)]
48 #![feature(trusted_step)]
49 #![feature(try_blocks)]
50 #![feature(try_reserve_kind)]
51 #![feature(nonzero_ops)]
52 #![feature(unwrap_infallible)]
53 #![feature(decl_macro)]
54 #![feature(drain_filter)]
55 #![feature(intra_doc_pointers)]
56 #![feature(yeet_expr)]
57 #![feature(result_option_inspect)]
58 #![feature(const_option)]
59 #![recursion_limit = "512"]
60 #![allow(rustc::potential_query_instability)]
61
62 #[macro_use]
63 extern crate bitflags;
64 #[macro_use]
65 extern crate rustc_macros;
66 #[macro_use]
67 extern crate rustc_data_structures;
68 #[macro_use]
69 extern crate tracing;
70 #[macro_use]
71 extern crate smallvec;
72
73 #[cfg(test)]
74 mod tests;
75
76 #[macro_use]
77 mod macros;
78
79 #[macro_use]
80 pub mod query;
81
82 #[macro_use]
83 pub mod arena;
84 #[macro_use]
85 pub mod dep_graph;
86 pub(crate) mod error;
87 pub mod hir;
88 pub mod infer;
89 pub mod lint;
90 pub mod metadata;
91 pub mod middle;
92 pub mod mir;
93 pub mod thir;
94 pub mod traits;
95 pub mod ty;
96 mod values;
97
98 pub mod util {
99     pub mod bug;
100     pub mod common;
101 }
102
103 // Allows macros to refer to this crate as `::rustc_middle`
104 extern crate self as rustc_middle;