lib.rs 4.6 KB
Newer Older
S
sevrak 已提交
1
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2 3 4 5 6 7 8 9 10
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

S
Steve Klabnik 已提交
11 12 13 14 15
//! The Rust compiler.
//!
//! # Note
//!
//! This API is completely unstable and subject to change.
16

17 18
// Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
#![cfg_attr(stage0, feature(custom_attribute))]
19
#![crate_name = "rustc"]
20
#![unstable(feature = "rustc_private", issue = "27812")]
B
Brian Anderson 已提交
21
#![staged_api]
22 23
#![crate_type = "dylib"]
#![crate_type = "rlib"]
24
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
A
Alex Crichton 已提交
25
      html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
26
      html_root_url = "https://doc.rust-lang.org/nightly/")]
B
Brian Anderson 已提交
27

T
Fallout  
Tamir Duberstein 已提交
28
#![feature(associated_consts)]
29
#![feature(box_patterns)]
30
#![feature(box_syntax)]
31
#![feature(clone_from_slice)]
32
#![feature(collections)]
N
Niko Matsakis 已提交
33
#![feature(const_fn)]
34
#![feature(core)]
35
#![feature(duration_span)]
36
#![feature(dynamic_lib)]
37
#![feature(enumset)]
38
#![feature(hashmap_hasher)]
T
Fallout  
Tamir Duberstein 已提交
39
#![feature(into_cow)]
40 41
#![feature(iter_cmp)]
#![feature(iter_arith)]
42
#![feature(libc)]
43
#![feature(nonzero)]
44
#![feature(num_bits_bytes)]
A
Alex Crichton 已提交
45 46
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
47
#![feature(rustc_private)]
48
#![feature(scoped_tls)]
T
Fallout  
Tamir Duberstein 已提交
49
#![feature(slice_patterns)]
A
Alex Crichton 已提交
50
#![feature(staged_api)]
51
#![feature(str_char)]
52
#![feature(vec_push_all)]
53
#![feature(wrapping)]
54
#![feature(cell_extras)]
55
#![cfg_attr(test, feature(test))]
56

N
Nick Cameron 已提交
57
#![allow(trivial_casts)]
N
Nick Cameron 已提交
58

A
Alex Crichton 已提交
59
extern crate arena;
60
extern crate core;
61
extern crate flate;
62
extern crate fmt_macros;
63
extern crate getopts;
64
extern crate graphviz;
65
extern crate libc;
66 67
extern crate rustc_llvm;
extern crate rustc_back;
68
extern crate rustc_front;
69
extern crate rustc_data_structures;
A
Alex Crichton 已提交
70
extern crate serialize;
71
extern crate rbml;
A
Alexis Beingessner 已提交
72
extern crate collections;
A
Alex Crichton 已提交
73 74
#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
75
#[macro_use] #[no_link] extern crate rustc_bitflags;
76

A
Alex Crichton 已提交
77
extern crate serialize as rustc_serialize; // used by deriving
78

79 80 81
#[cfg(test)]
extern crate test;

82 83
pub use rustc_llvm as llvm;

84 85 86
#[macro_use]
mod macros;

87 88 89
// NB: This module needs to be declared first so diagnostics are
// registered before they are used.
pub mod diagnostics;
90

91 92
pub mod back {
    pub use rustc_back::abi;
93
    pub use rustc_back::rpath;
94 95 96
    pub use rustc_back::svh;
}

97
pub mod front {
S
Seo Sanghyeon 已提交
98
    pub mod check_attr;
99 100
    pub mod map;
}
101

102
pub mod middle {
103
    pub mod expr_use_visitor; // STAGE0: increase glitch immunity
104
    pub mod astconv_util;
105 106 107
    pub mod astencode;
    pub mod cfg;
    pub mod check_const;
108
    pub mod check_static_recursion;
109 110
    pub mod check_loop;
    pub mod check_match;
111
    pub mod check_no_asm;
N
Nick Cameron 已提交
112
    pub mod check_rvalues;
113
    pub mod const_eval;
N
Niko Matsakis 已提交
114
    pub mod dataflow;
115 116
    pub mod dead;
    pub mod def;
N
Niko Matsakis 已提交
117
    pub mod def_id;
118 119 120
    pub mod dependency_format;
    pub mod effect;
    pub mod entry;
121
    pub mod free_region;
122
    pub mod intrinsicck;
123
    pub mod infer;
124
    pub mod implicator;
125
    pub mod lang_items;
126 127 128
    pub mod liveness;
    pub mod mem_categorization;
    pub mod pat_util;
129
    pub mod privacy;
130
    pub mod reachable;
131
    pub mod region;
132
    pub mod recursion_limit;
133
    pub mod resolve_lifetime;
A
Aaron Turon 已提交
134
    pub mod stability;
135
    pub mod subst;
136
    pub mod traits;
137 138
    pub mod ty;
    pub mod weak_lang_items;
139 140
}

141
pub mod metadata;
142

143
pub mod session;
G
Graydon Hoare 已提交
144

K
Keegan McAllister 已提交
145
pub mod plugin;
146

K
Keegan McAllister 已提交
147 148
pub mod lint;

149
pub mod util {
150
    pub use rustc_back::sha2;
151

152 153
    pub mod common;
    pub mod ppaux;
154
    pub mod nodemap;
155
    pub mod num;
156
    pub mod fs;
G
Graydon Hoare 已提交
157 158
}

159
pub mod lib {
160
    pub use llvm;
G
Graydon Hoare 已提交
161 162
}

163 164 165 166 167 168 169 170
// A private module so that macro-expanded idents like
// `::rustc::lint::Lint` will also work in `rustc` itself.
//
// `libstd` uses the same trick.
#[doc(hidden)]
mod rustc {
    pub use lint;
}
171

172 173 174 175 176 177 178 179 180 181 182 183 184
// FIXME(#27438): right now the unit tests of librustc don't refer to any actual
//                functions generated in librustc_data_structures (all
//                references are through generic functions), but statics are
//                referenced from time to time. Due to this bug we won't
//                actually correctly link in the statics unless we also
//                reference a function, so be sure to reference a dummy
//                function.
#[test]
fn noop() {
    rustc_data_structures::__noop_fix_for_27438();
}


185 186
// Build the diagnostics array at the end so that the metadata includes error use sites.
__build_diagnostic_array! { librustc, DIAGNOSTICS }