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