]> git.lizzy.rs Git - rust.git/blob - src/librustc/lib.rs
Make Place Boxed on Statement to reduce size from 64 bytes to 32 bytes
[rust.git] / src / librustc / 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 `librustc_mir` 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 //! - **Traits.** Trait resolution is implemented in the `traits` module.
17 //! - **Type inference.** The type inference code can be found in the `infer` module;
18 //!   this code handles low-level equality and subtyping operations. The
19 //!   type check pass in the compiler is found in the `librustc_typeck` crate.
20 //!
21 //! For more information about how rustc works, see the [rustc guide].
22 //!
23 //! [rustc guide]: https://rust-lang.github.io/rustc-guide/
24 //!
25 //! # Note
26 //!
27 //! This API is completely unstable and subject to change.
28
29 #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
30
31 #![feature(arbitrary_self_types)]
32 #![feature(box_patterns)]
33 #![feature(box_syntax)]
34 #![feature(const_fn)]
35 #![feature(const_transmute)]
36 #![feature(core_intrinsics)]
37 #![feature(drain_filter)]
38 #![feature(inner_deref)]
39 #![cfg_attr(windows, feature(libc))]
40 #![feature(never_type)]
41 #![feature(exhaustive_patterns)]
42 #![feature(overlapping_marker_traits)]
43 #![feature(extern_types)]
44 #![feature(nll)]
45 #![feature(non_exhaustive)]
46 #![feature(optin_builtin_traits)]
47 #![feature(range_is_empty)]
48 #![feature(slice_patterns)]
49 #![feature(specialization)]
50 #![feature(unboxed_closures)]
51 #![feature(thread_local)]
52 #![feature(trace_macros)]
53 #![feature(trusted_len)]
54 #![feature(vec_remove_item)]
55 #![feature(stmt_expr_attributes)]
56 #![feature(integer_atomics)]
57 #![feature(test)]
58 #![feature(in_band_lifetimes)]
59 #![feature(crate_visibility_modifier)]
60 #![feature(proc_macro_hygiene)]
61 #![feature(log_syntax)]
62 #![feature(mem_take)]
63 #![feature(associated_type_bounds)]
64 #![feature(rustc_attrs)]
65
66 #![recursion_limit="512"]
67
68 #[macro_use] extern crate bitflags;
69 extern crate getopts;
70 #[macro_use] extern crate lazy_static;
71 #[macro_use] extern crate scoped_tls;
72 #[cfg(windows)]
73 extern crate libc;
74 #[macro_use] extern crate rustc_macros;
75 #[macro_use] extern crate rustc_data_structures;
76 #[macro_use] extern crate log;
77 #[macro_use] extern crate syntax;
78 #[macro_use] extern crate smallvec;
79
80 // Use the test crate here so we depend on getopts through it. This allow tools to link to both
81 // librustc_driver and libtest.
82 extern crate test as _;
83
84 #[cfg(test)]
85 mod tests;
86
87 #[macro_use]
88 mod macros;
89
90 pub mod error_codes;
91
92 #[macro_use]
93 pub mod query;
94
95 #[macro_use]
96 pub mod arena;
97 pub mod dep_graph;
98 pub mod hir;
99 pub mod ich;
100 pub mod infer;
101 pub mod lint;
102
103 pub mod middle {
104     pub mod borrowck;
105     pub mod expr_use_visitor;
106     pub mod cstore;
107     pub mod dead;
108     pub mod dependency_format;
109     pub mod diagnostic_items;
110     pub mod entry;
111     pub mod exported_symbols;
112     pub mod free_region;
113     pub mod intrinsicck;
114     pub mod lib_features;
115     pub mod lang_items;
116     pub mod liveness;
117     pub mod mem_categorization;
118     pub mod privacy;
119     pub mod reachable;
120     pub mod region;
121     pub mod recursion_limit;
122     pub mod resolve_lifetime;
123     pub mod stability;
124     pub mod weak_lang_items;
125 }
126
127 pub mod mir;
128 pub mod session;
129 pub mod traits;
130 pub mod ty;
131
132 pub mod util {
133     pub mod captures;
134     pub mod common;
135     pub mod nodemap;
136     pub mod profiling;
137     pub mod bug;
138 }
139
140 // Allows macros to refer to this crate as `::rustc`
141 extern crate self as rustc;