lib.rs 4.5 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")]
B
Brian Anderson 已提交
21
#![staged_api]
22 23 24
#![crate_type = "dylib"]
#![crate_type = "rlib"]
#![doc(html_logo_url = "http://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 = "http://doc.rust-lang.org/nightly/")]
B
Brian Anderson 已提交
27

28
#![feature(append)]
T
Fallout  
Tamir Duberstein 已提交
29
#![feature(associated_consts)]
30
#![feature(box_patterns)]
31
#![feature(box_syntax)]
32
#![feature(clone_from_slice)]
33
#![feature(collections)]
N
Niko Matsakis 已提交
34
#![feature(const_fn)]
35 36
#![feature(duration)]
#![feature(duration_span)]
37
#![feature(dynamic_lib)]
38
#![feature(enumset)]
39
#![feature(fs_canonicalize)]
40
#![feature(hash_default)]
41
#![feature(hashmap_hasher)]
T
Fallout  
Tamir Duberstein 已提交
42
#![feature(into_cow)]
43 44
#![feature(iter_cmp)]
#![feature(iter_arith)]
45
#![feature(libc)]
46
#![feature(map_in_place)]
47
#![feature(num_bits_bytes)]
T
Fallout  
Tamir Duberstein 已提交
48
#![feature(path_ext)]
A
Alex Crichton 已提交
49
#![feature(quote)]
50 51
#![feature(range_inclusive)]
#![feature(ref_slice)]
A
Alex Crichton 已提交
52
#![feature(rustc_diagnostic_macros)]
53
#![feature(rustc_private)]
54
#![feature(slice_bytes)]
55
#![feature(slice_extras)]
T
Fallout  
Tamir Duberstein 已提交
56
#![feature(slice_patterns)]
57
#![feature(slice_position_elem)]
A
Alex Crichton 已提交
58
#![feature(staged_api)]
59
#![feature(str_char)]
60 61
#![feature(str_matches)]
#![feature(vec_push_all)]
62
#![feature(wrapping)]
63
#![cfg_attr(test, feature(test))]
64

N
Nick Cameron 已提交
65
#![allow(trivial_casts)]
N
Nick Cameron 已提交
66

A
Alex Crichton 已提交
67
extern crate arena;
68
extern crate flate;
69
extern crate fmt_macros;
70
extern crate getopts;
71
extern crate graphviz;
72
extern crate libc;
73 74
extern crate rustc_llvm;
extern crate rustc_back;
75
extern crate rustc_data_structures;
A
Alex Crichton 已提交
76
extern crate serialize;
77
extern crate rbml;
A
Alexis Beingessner 已提交
78
extern crate collections;
A
Alex Crichton 已提交
79 80
#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
81
#[macro_use] #[no_link] extern crate rustc_bitflags;
82

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

85 86 87
#[cfg(test)]
extern crate test;

88 89
pub use rustc_llvm as llvm;

90 91 92
#[macro_use]
mod macros;

93 94 95
// NB: This module needs to be declared first so diagnostics are
// registered before they are used.
pub mod diagnostics;
96

97 98
pub mod back {
    pub use rustc_back::abi;
99
    pub use rustc_back::archive;
100 101 102
    pub use rustc_back::arm;
    pub use rustc_back::mips;
    pub use rustc_back::mipsel;
103
    pub use rustc_back::rpath;
104 105 106 107 108 109
    pub use rustc_back::svh;
    pub use rustc_back::target_strs;
    pub use rustc_back::x86;
    pub use rustc_back::x86_64;
}

110 111
pub mod ast_map;

112
pub mod middle {
113
    pub mod astconv_util;
114
    pub mod astencode;
115
    pub mod cast;
116 117
    pub mod cfg;
    pub mod check_const;
118
    pub mod check_static_recursion;
119 120
    pub mod check_loop;
    pub mod check_match;
N
Nick Cameron 已提交
121
    pub mod check_rvalues;
122
    pub mod const_eval;
N
Niko Matsakis 已提交
123
    pub mod dataflow;
124 125 126 127 128 129
    pub mod dead;
    pub mod def;
    pub mod dependency_format;
    pub mod effect;
    pub mod entry;
    pub mod expr_use_visitor;
130
    pub mod fast_reject;
131
    pub mod free_region;
132
    pub mod intrinsicck;
133
    pub mod infer;
134
    pub mod implicator;
135
    pub mod lang_items;
136 137 138
    pub mod liveness;
    pub mod mem_categorization;
    pub mod pat_util;
139
    pub mod privacy;
140
    pub mod reachable;
141
    pub mod region;
142
    pub mod recursion_limit;
143
    pub mod resolve_lifetime;
A
Aaron Turon 已提交
144
    pub mod stability;
145
    pub mod subst;
146
    pub mod traits;
147 148
    pub mod ty;
    pub mod ty_fold;
149
    pub mod ty_match;
150
    pub mod ty_relate;
151
    pub mod ty_walk;
152
    pub mod weak_lang_items;
153 154
}

155
pub mod metadata;
156

157
pub mod session;
G
Graydon Hoare 已提交
158

K
Keegan McAllister 已提交
159
pub mod plugin;
160

K
Keegan McAllister 已提交
161 162
pub mod lint;

163
pub mod util {
164
    pub use rustc_back::sha2;
165

166 167
    pub mod common;
    pub mod ppaux;
168
    pub mod nodemap;
A
Alex Crichton 已提交
169
    pub mod lev_distance;
170
    pub mod num;
171
    pub mod fs;
G
Graydon Hoare 已提交
172 173
}

174
pub mod lib {
175
    pub use llvm;
G
Graydon Hoare 已提交
176 177
}

178 179 180 181 182 183 184 185
// 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;
}
186 187 188

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