]> git.lizzy.rs Git - rust.git/blob - src/librustc/lib.rs
Move the HIR cfg to `rustc_ast_borrowck`
[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(rustc_diagnostic_macros)]
49 #![feature(slice_patterns)]
50 #![feature(specialization)]
51 #![feature(unboxed_closures)]
52 #![feature(thread_local)]
53 #![feature(trace_macros)]
54 #![feature(trusted_len)]
55 #![feature(vec_remove_item)]
56 #![feature(stmt_expr_attributes)]
57 #![feature(integer_atomics)]
58 #![feature(test)]
59 #![feature(in_band_lifetimes)]
60 #![feature(crate_visibility_modifier)]
61 #![feature(proc_macro_hygiene)]
62 #![feature(log_syntax)]
63 #![feature(mem_take)]
64 #![feature(associated_type_bounds)]
65 #![feature(rustc_attrs)]
66
67 #![recursion_limit="512"]
68
69 #[macro_use] extern crate bitflags;
70 extern crate getopts;
71 #[macro_use] extern crate lazy_static;
72 #[macro_use] extern crate scoped_tls;
73 #[cfg(windows)]
74 extern crate libc;
75 #[macro_use] extern crate rustc_macros;
76 #[macro_use] extern crate rustc_data_structures;
77 #[macro_use] extern crate log;
78 #[macro_use] extern crate syntax;
79 #[macro_use] extern crate smallvec;
80
81 // Use the test crate here so we depend on getopts through it. This allow tools to link to both
82 // librustc_driver and libtest.
83 extern crate test as _;
84
85 #[cfg(test)]
86 mod tests;
87
88 #[macro_use]
89 mod macros;
90
91 // N.B., this module needs to be declared first so diagnostics are
92 // registered before they are used.
93 pub mod error_codes;
94
95 #[macro_use]
96 pub mod query;
97
98 #[macro_use]
99 pub mod arena;
100 pub mod dep_graph;
101 pub mod hir;
102 pub mod ich;
103 pub mod infer;
104 pub mod lint;
105
106 pub mod middle {
107     pub mod borrowck;
108     pub mod expr_use_visitor;
109     pub mod cstore;
110     pub mod dead;
111     pub mod dependency_format;
112     pub mod diagnostic_items;
113     pub mod entry;
114     pub mod exported_symbols;
115     pub mod free_region;
116     pub mod intrinsicck;
117     pub mod lib_features;
118     pub mod lang_items;
119     pub mod liveness;
120     pub mod mem_categorization;
121     pub mod privacy;
122     pub mod reachable;
123     pub mod region;
124     pub mod recursion_limit;
125     pub mod resolve_lifetime;
126     pub mod stability;
127     pub mod weak_lang_items;
128 }
129
130 pub mod mir;
131 pub mod session;
132 pub mod traits;
133 pub mod ty;
134
135 pub mod util {
136     pub mod captures;
137     pub mod common;
138     pub mod nodemap;
139     pub mod profiling;
140     pub mod bug;
141 }
142
143 // Allows macros to refer to this crate as `::rustc`
144 extern crate self as rustc;
145
146 // Build the diagnostics array at the end so that the metadata includes error use sites.
147 __build_diagnostic_array! { librustc, DIAGNOSTICS }