]> git.lizzy.rs Git - rust.git/blob - src/librustc/lib.rs
82f01c36fee7f6960d6942bae39cd20b4402ee5c
[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 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
18        html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
19        html_root_url = "https://doc.rust-lang.org/nightly/")]
20 #![deny(warnings)]
21
22 #![feature(box_patterns)]
23 #![feature(box_syntax)]
24 #![feature(conservative_impl_trait)]
25 #![feature(const_fn)]
26 #![feature(core_intrinsics)]
27 #![feature(i128_type)]
28 #![cfg_attr(windows, feature(libc))]
29 #![feature(never_type)]
30 #![feature(nonzero)]
31 #![feature(quote)]
32 #![feature(rustc_diagnostic_macros)]
33 #![feature(slice_patterns)]
34 #![feature(specialization)]
35 #![feature(unboxed_closures)]
36 #![feature(trace_macros)]
37 #![feature(test)]
38
39 #![recursion_limit="256"]
40
41 extern crate arena;
42 extern crate core;
43 extern crate fmt_macros;
44 extern crate getopts;
45 extern crate graphviz;
46 #[cfg(windows)]
47 extern crate libc;
48 extern crate owning_ref;
49 extern crate rustc_back;
50 extern crate rustc_data_structures;
51 extern crate serialize;
52 extern crate rustc_const_math;
53 extern crate rustc_errors as errors;
54 #[macro_use] extern crate log;
55 #[macro_use] extern crate syntax;
56 extern crate syntax_pos;
57 #[macro_use] #[no_link] extern crate rustc_bitflags;
58 extern crate jobserver;
59
60 extern crate serialize as rustc_serialize; // used by deriving
61
62 // Note that librustc doesn't actually depend on these crates, see the note in
63 // `Cargo.toml` for this crate about why these are here.
64 #[allow(unused_extern_crates)]
65 extern crate flate2;
66 #[allow(unused_extern_crates)]
67 extern crate test;
68
69 #[macro_use]
70 mod macros;
71
72 // NB: This module needs to be declared first so diagnostics are
73 // registered before they are used.
74 pub mod diagnostics;
75
76 pub mod cfg;
77 pub mod dep_graph;
78 pub mod hir;
79 pub mod ich;
80 pub mod infer;
81 pub mod lint;
82
83 pub mod middle {
84     pub mod allocator;
85     pub mod expr_use_visitor;
86     pub mod const_val;
87     pub mod cstore;
88     pub mod dataflow;
89     pub mod dead;
90     pub mod dependency_format;
91     pub mod effect;
92     pub mod entry;
93     pub mod free_region;
94     pub mod intrinsicck;
95     pub mod lang_items;
96     pub mod liveness;
97     pub mod mem_categorization;
98     pub mod privacy;
99     pub mod reachable;
100     pub mod region;
101     pub mod recursion_limit;
102     pub mod resolve_lifetime;
103     pub mod stability;
104     pub mod weak_lang_items;
105 }
106
107 pub mod mir;
108 pub mod session;
109 pub mod traits;
110 pub mod ty;
111
112 pub mod util {
113     pub mod common;
114     pub mod ppaux;
115     pub mod nodemap;
116     pub mod fs;
117 }
118
119 // A private module so that macro-expanded idents like
120 // `::rustc::lint::Lint` will also work in `rustc` itself.
121 //
122 // `libstd` uses the same trick.
123 #[doc(hidden)]
124 mod rustc {
125     pub use lint;
126 }
127
128 // FIXME(#27438): right now the unit tests of librustc don't refer to any actual
129 //                functions generated in librustc_data_structures (all
130 //                references are through generic functions), but statics are
131 //                referenced from time to time. Due to this bug we won't
132 //                actually correctly link in the statics unless we also
133 //                reference a function, so be sure to reference a dummy
134 //                function.
135 #[test]
136 fn noop() {
137     rustc_data_structures::__noop_fix_for_27438();
138 }
139
140
141 // Build the diagnostics array at the end so that the metadata includes error use sites.
142 __build_diagnostic_array! { librustc, DIAGNOSTICS }