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