]> git.lizzy.rs Git - rust.git/blob - src/librustc/lib.rs
Rollup merge of #56321 - jnqnfe:css_nested_list_margin, r=GuillaumeGomez
[rust.git] / src / librustc / lib.rs
1 // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! The "main crate" of the Rust compiler. This crate contains common
12 //! type definitions that are used by the other crates in the rustc
13 //! "family". Some prominent examples (note that each of these modules
14 //! has their own README with further details).
15 //!
16 //! - **HIR.** The "high-level (H) intermediate representation (IR)" is
17 //!   defined in the `hir` module.
18 //! - **MIR.** The "mid-level (M) intermediate representation (IR)" is
19 //!   defined in the `mir` module. This module contains only the
20 //!   *definition* of the MIR; the passes that transform and operate
21 //!   on MIR are found in `librustc_mir` crate.
22 //! - **Types.** The internal representation of types used in rustc is
23 //!   defined in the `ty` module. This includes the **type context**
24 //!   (or `tcx`), which is the central context during most of
25 //!   compilation, containing the interners and other things.
26 //! - **Traits.** Trait resolution is implemented in the `traits` module.
27 //! - **Type inference.** The type inference code can be found in the `infer` module;
28 //!   this code handles low-level equality and subtyping operations. The
29 //!   type check pass in the compiler is found in the `librustc_typeck` crate.
30 //!
31 //! For more information about how rustc works, see the [rustc guide].
32 //!
33 //! [rustc guide]: https://rust-lang.github.io/rustc-guide/
34 //!
35 //! # Note
36 //!
37 //! This API is completely unstable and subject to change.
38
39 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
40        html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
41        html_root_url = "https://doc.rust-lang.org/nightly/")]
42
43 #![feature(box_patterns)]
44 #![feature(box_syntax)]
45 #![feature(core_intrinsics)]
46 #![feature(drain_filter)]
47 #![cfg_attr(windows, feature(libc))]
48 #![feature(never_type)]
49 #![feature(exhaustive_patterns)]
50 #![feature(extern_types)]
51 #![feature(nll)]
52 #![feature(non_exhaustive)]
53 #![feature(proc_macro_internals)]
54 #![feature(quote)]
55 #![feature(optin_builtin_traits)]
56 #![feature(refcell_replace_swap)]
57 #![feature(rustc_diagnostic_macros)]
58 #![feature(rustc_attrs)]
59 #![feature(slice_patterns)]
60 #![feature(slice_sort_by_cached_key)]
61 #![feature(specialization)]
62 #![feature(unboxed_closures)]
63 #![feature(trace_macros)]
64 #![feature(trusted_len)]
65 #![feature(vec_remove_item)]
66 #![feature(step_trait)]
67 #![feature(integer_atomics)]
68 #![feature(test)]
69 #![feature(in_band_lifetimes)]
70 #![feature(crate_visibility_modifier)]
71 #![feature(transpose_result)]
72
73 #![recursion_limit="512"]
74
75 #![warn(elided_lifetimes_in_paths)]
76
77 extern crate arena;
78 #[macro_use] extern crate bitflags;
79 extern crate core;
80 extern crate fmt_macros;
81 extern crate getopts;
82 extern crate graphviz;
83 #[macro_use] extern crate lazy_static;
84 #[macro_use] extern crate scoped_tls;
85 #[cfg(windows)]
86 extern crate libc;
87 extern crate polonius_engine;
88 extern crate rustc_target;
89 #[macro_use] extern crate rustc_data_structures;
90 extern crate serialize;
91 extern crate parking_lot;
92 extern crate rustc_errors as errors;
93 extern crate rustc_rayon as rayon;
94 extern crate rustc_rayon_core as rayon_core;
95 #[macro_use] extern crate log;
96 #[macro_use] extern crate syntax;
97 extern crate syntax_pos;
98 extern crate jobserver;
99 extern crate proc_macro;
100 extern crate chalk_engine;
101 extern crate rustc_fs_util;
102
103 extern crate serialize as rustc_serialize; // used by deriving
104
105 extern crate rustc_apfloat;
106 extern crate byteorder;
107 extern crate backtrace;
108
109 #[macro_use]
110 extern crate smallvec;
111
112 // Note that librustc doesn't actually depend on these crates, see the note in
113 // `Cargo.toml` for this crate about why these are here.
114 #[allow(unused_extern_crates)]
115 extern crate flate2;
116 #[allow(unused_extern_crates)]
117 extern crate test;
118
119 #[macro_use]
120 mod macros;
121
122 // NB: This module needs to be declared first so diagnostics are
123 // registered before they are used.
124 pub mod diagnostics;
125
126 pub mod cfg;
127 pub mod dep_graph;
128 pub mod hir;
129 pub mod ich;
130 pub mod infer;
131 pub mod lint;
132
133 pub mod middle {
134     pub mod allocator;
135     pub mod borrowck;
136     pub mod expr_use_visitor;
137     pub mod cstore;
138     pub mod dead;
139     pub mod dependency_format;
140     pub mod entry;
141     pub mod exported_symbols;
142     pub mod free_region;
143     pub mod intrinsicck;
144     pub mod lib_features;
145     pub mod lang_items;
146     pub mod liveness;
147     pub mod mem_categorization;
148     pub mod privacy;
149     pub mod reachable;
150     pub mod region;
151     pub mod recursion_limit;
152     pub mod resolve_lifetime;
153     pub mod stability;
154     pub mod weak_lang_items;
155 }
156
157 pub mod mir;
158 pub mod session;
159 pub mod traits;
160 pub mod ty;
161
162 pub mod util {
163     pub mod captures;
164     pub mod common;
165     pub mod ppaux;
166     pub mod nodemap;
167     pub mod time_graph;
168     pub mod profiling;
169     pub mod bug;
170 }
171
172 // A private module so that macro-expanded idents like
173 // `::rustc::lint::Lint` will also work in `rustc` itself.
174 //
175 // `libstd` uses the same trick.
176 #[doc(hidden)]
177 mod rustc {
178     pub use lint;
179 }
180
181 // FIXME(#27438): right now the unit tests of librustc don't refer to any actual
182 //                functions generated in librustc_data_structures (all
183 //                references are through generic functions), but statics are
184 //                referenced from time to time. Due to this bug we won't
185 //                actually correctly link in the statics unless we also
186 //                reference a function, so be sure to reference a dummy
187 //                function.
188 #[test]
189 fn noop() {
190     rustc_data_structures::__noop_fix_for_27438();
191 }
192
193
194 // Build the diagnostics array at the end so that the metadata includes error use sites.
195 __build_diagnostic_array! { librustc, DIAGNOSTICS }