]> git.lizzy.rs Git - rust.git/blob - src/librustc/lib.rs
Auto merge of #28396 - arielb1:misplaced-binding, r=eddyb
[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 Rust compiler.
12 //!
13 //! # Note
14 //!
15 //! This API is completely unstable and subject to change.
16
17 // Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
18 #![cfg_attr(stage0, feature(custom_attribute))]
19 #![crate_name = "rustc"]
20 #![unstable(feature = "rustc_private", issue = "27812")]
21 #![staged_api]
22 #![crate_type = "dylib"]
23 #![crate_type = "rlib"]
24 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
25       html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
26       html_root_url = "https://doc.rust-lang.org/nightly/")]
27
28 #![feature(associated_consts)]
29 #![feature(box_patterns)]
30 #![feature(box_syntax)]
31 #![feature(clone_from_slice)]
32 #![feature(collections)]
33 #![feature(const_fn)]
34 #![feature(core)]
35 #![feature(duration_span)]
36 #![feature(dynamic_lib)]
37 #![feature(enumset)]
38 #![feature(fs_canonicalize)]
39 #![feature(hashmap_hasher)]
40 #![feature(into_cow)]
41 #![feature(iter_cmp)]
42 #![feature(iter_arith)]
43 #![feature(libc)]
44 #![feature(nonzero)]
45 #![feature(num_bits_bytes)]
46 #![feature(path_ext)]
47 #![feature(quote)]
48 #![feature(range_inclusive)]
49 #![feature(ref_slice)]
50 #![feature(rustc_diagnostic_macros)]
51 #![feature(rustc_private)]
52 #![feature(scoped_tls)]
53 #![feature(slice_splits)]
54 #![feature(slice_patterns)]
55 #![feature(staged_api)]
56 #![feature(str_char)]
57 #![feature(str_match_indices)]
58 #![feature(vec_push_all)]
59 #![feature(wrapping)]
60 #![feature(cell_extras)]
61 #![cfg_attr(test, feature(test))]
62
63 #![allow(trivial_casts)]
64
65 extern crate arena;
66 extern crate core;
67 extern crate flate;
68 extern crate fmt_macros;
69 extern crate getopts;
70 extern crate graphviz;
71 extern crate libc;
72 extern crate rustc_llvm;
73 extern crate rustc_back;
74 extern crate rustc_front;
75 extern crate rustc_data_structures;
76 extern crate serialize;
77 extern crate rbml;
78 extern crate collections;
79 #[macro_use] extern crate log;
80 #[macro_use] extern crate syntax;
81 #[macro_use] #[no_link] extern crate rustc_bitflags;
82
83 extern crate serialize as rustc_serialize; // used by deriving
84
85 #[cfg(test)]
86 extern crate test;
87
88 pub use rustc_llvm as llvm;
89
90 #[macro_use]
91 mod macros;
92
93 // NB: This module needs to be declared first so diagnostics are
94 // registered before they are used.
95 pub mod diagnostics;
96
97 pub mod back {
98     pub use rustc_back::abi;
99     pub use rustc_back::rpath;
100     pub use rustc_back::svh;
101 }
102
103 pub mod front {
104     pub mod map;
105 }
106
107 pub mod middle {
108     pub mod astconv_util;
109     pub mod astencode;
110     pub mod cast;
111     pub mod cfg;
112     pub mod check_const;
113     pub mod check_static_recursion;
114     pub mod check_loop;
115     pub mod check_match;
116     pub mod check_no_asm;
117     pub mod check_rvalues;
118     pub mod const_eval;
119     pub mod dataflow;
120     pub mod dead;
121     pub mod def;
122     pub mod def_id;
123     pub mod dependency_format;
124     pub mod effect;
125     pub mod entry;
126     pub mod expr_use_visitor;
127     pub mod fast_reject;
128     pub mod free_region;
129     pub mod intrinsicck;
130     pub mod infer;
131     pub mod implicator;
132     pub mod lang_items;
133     pub mod liveness;
134     pub mod mem_categorization;
135     pub mod outlives;
136     pub mod pat_util;
137     pub mod privacy;
138     pub mod reachable;
139     pub mod region;
140     pub mod recursion_limit;
141     pub mod resolve_lifetime;
142     pub mod stability;
143     pub mod subst;
144     pub mod traits;
145     pub mod ty;
146     pub mod ty_fold;
147     pub mod ty_match;
148     pub mod ty_relate;
149     pub mod ty_walk;
150     pub mod wf;
151     pub mod weak_lang_items;
152 }
153
154 pub mod metadata;
155
156 pub mod session;
157
158 pub mod plugin;
159
160 pub mod lint;
161
162 pub mod util {
163     pub use rustc_back::sha2;
164
165     pub mod common;
166     pub mod ppaux;
167     pub mod nodemap;
168     pub mod lev_distance;
169     pub mod num;
170     pub mod fs;
171 }
172
173 pub mod lib {
174     pub use llvm;
175 }
176
177 // A private module so that macro-expanded idents like
178 // `::rustc::lint::Lint` will also work in `rustc` itself.
179 //
180 // `libstd` uses the same trick.
181 #[doc(hidden)]
182 mod rustc {
183     pub use lint;
184 }
185
186 // FIXME(#27438): right now the unit tests of librustc don't refer to any actual
187 //                functions generated in librustc_data_structures (all
188 //                references are through generic functions), but statics are
189 //                referenced from time to time. Due to this bug we won't
190 //                actually correctly link in the statics unless we also
191 //                reference a function, so be sure to reference a dummy
192 //                function.
193 #[test]
194 fn noop() {
195     rustc_data_structures::__noop_fix_for_27438();
196 }
197
198
199 // Build the diagnostics array at the end so that the metadata includes error use sites.
200 __build_diagnostic_array! { librustc, DIAGNOSTICS }