lib.rs 4.2 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
#![crate_name = "rustc"]
18
#![unstable(feature = "rustc_private", issue = "27812")]
19 20
#![crate_type = "dylib"]
#![crate_type = "rlib"]
21
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
A
Alex Crichton 已提交
22
      html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
23
      html_root_url = "https://doc.rust-lang.org/nightly/")]
B
Brian Anderson 已提交
24

T
Fallout  
Tamir Duberstein 已提交
25
#![feature(associated_consts)]
26
#![feature(box_patterns)]
27
#![feature(box_syntax)]
28
#![feature(cell_extras)]
29
#![feature(collections)]
N
Niko Matsakis 已提交
30
#![feature(const_fn)]
31
#![feature(enumset)]
32
#![feature(hashmap_hasher)]
33
#![feature(iter_arith)]
34
#![feature(libc)]
35
#![feature(nonzero)]
A
Alex Crichton 已提交
36 37
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
38
#![feature(rustc_private)]
39
#![feature(scoped_tls)]
T
Fallout  
Tamir Duberstein 已提交
40
#![feature(slice_patterns)]
A
Alex Crichton 已提交
41
#![feature(staged_api)]
42
#![feature(str_char)]
43
#![feature(time2)]
44
#![cfg_attr(test, feature(test))]
45

N
Nick Cameron 已提交
46
#![allow(trivial_casts)]
N
Nick Cameron 已提交
47

A
Alex Crichton 已提交
48
extern crate arena;
49
extern crate core;
50
extern crate flate;
51
extern crate fmt_macros;
52
extern crate getopts;
53
extern crate graphviz;
54
extern crate libc;
55
extern crate rbml;
56 57
extern crate rustc_llvm;
extern crate rustc_back;
58
extern crate rustc_front;
59
extern crate rustc_data_structures;
A
Alex Crichton 已提交
60
extern crate serialize;
A
Alexis Beingessner 已提交
61
extern crate collections;
A
Alex Crichton 已提交
62 63
#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
64
#[macro_use] #[no_link] extern crate rustc_bitflags;
65

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

68 69 70
#[cfg(test)]
extern crate test;

71 72
pub use rustc_llvm as llvm;

73 74 75
#[macro_use]
mod macros;

76 77 78
// NB: This module needs to be declared first so diagnostics are
// registered before they are used.
pub mod diagnostics;
79

80 81
pub mod back {
    pub use rustc_back::abi;
82
    pub use rustc_back::rpath;
83 84 85
    pub use rustc_back::svh;
}

86 87
pub mod dep_graph;

88
pub mod front {
S
Seo Sanghyeon 已提交
89
    pub mod check_attr;
90 91
    pub mod map;
}
92

93
pub mod middle {
94
    pub mod astconv_util;
95
    pub mod expr_use_visitor; // STAGE0: increase glitch immunity
96
    pub mod cfg;
97
    pub mod check_match;
98
    pub mod const_eval;
99
    pub mod const_qualif;
100
    pub mod cstore;
N
Niko Matsakis 已提交
101
    pub mod dataflow;
102 103
    pub mod dead;
    pub mod def;
N
Niko Matsakis 已提交
104
    pub mod def_id;
105 106 107
    pub mod dependency_format;
    pub mod effect;
    pub mod entry;
108
    pub mod free_region;
109
    pub mod intrinsicck;
110
    pub mod infer;
111
    pub mod implicator;
112
    pub mod lang_items;
113 114 115
    pub mod liveness;
    pub mod mem_categorization;
    pub mod pat_util;
116
    pub mod privacy;
117
    pub mod reachable;
118
    pub mod region;
119
    pub mod recursion_limit;
120
    pub mod resolve_lifetime;
A
Aaron Turon 已提交
121
    pub mod stability;
122
    pub mod subst;
123
    pub mod traits;
124 125
    pub mod ty;
    pub mod weak_lang_items;
126 127
}

128 129 130
pub mod mir {
    pub mod repr;
    pub mod tcx;
131
    pub mod visit;
132 133
}

134
pub mod session;
G
Graydon Hoare 已提交
135

K
Keegan McAllister 已提交
136 137
pub mod lint;

138
pub mod util {
139
    pub use rustc_back::sha2;
140

141 142
    pub mod common;
    pub mod ppaux;
143
    pub mod nodemap;
144
    pub mod num;
145
    pub mod fs;
G
Graydon Hoare 已提交
146 147
}

148
pub mod lib {
149
    pub use llvm;
G
Graydon Hoare 已提交
150 151
}

152 153 154 155 156 157 158 159
// 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;
}
160

161 162 163 164 165 166 167 168 169 170 171 172 173
// 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();
}


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