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(scoped_tls)]
55
#![feature(slice_bytes)]
56
#![feature(slice_extras)]
T
Fallout  
Tamir Duberstein 已提交
57
#![feature(slice_patterns)]
58
#![feature(slice_position_elem)]
A
Alex Crichton 已提交
59
#![feature(staged_api)]
60
#![feature(str_char)]
61
#![feature(str_match_indices)]
62
#![feature(vec_push_all)]
63
#![feature(wrapping)]
64
#![feature(cell_extras)]
N
Nick Cameron 已提交
65
#![feature(page_size)]
66
#![cfg_attr(test, feature(test))]
67

N
Nick Cameron 已提交
68
#![allow(trivial_casts)]
N
Nick Cameron 已提交
69

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

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

88 89 90
#[cfg(test)]
extern crate test;

91 92
pub use rustc_llvm as llvm;

93 94 95
#[macro_use]
mod macros;

96 97 98
// NB: This module needs to be declared first so diagnostics are
// registered before they are used.
pub mod diagnostics;
99

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

112 113
pub mod ast_map;

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

157
pub mod metadata;
158

159
pub mod session;
G
Graydon Hoare 已提交
160

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

K
Keegan McAllister 已提交
163 164
pub mod lint;

165
pub mod util {
166
    pub use rustc_back::sha2;
167

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

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

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

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