lib.rs 4.1 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

T
Fallout  
Tamir Duberstein 已提交
28
#![feature(associated_consts)]
29
#![feature(box_patterns)]
30
#![feature(box_syntax)]
31 32
#![feature(collections)]
#![feature(core)]
33 34
#![feature(duration)]
#![feature(duration_span)]
35
#![feature(fs_canonicalize)]
A
Alex Crichton 已提交
36
#![feature(hash)]
T
Fallout  
Tamir Duberstein 已提交
37
#![feature(into_cow)]
38
#![feature(libc)]
T
Fallout  
Tamir Duberstein 已提交
39
#![feature(path_ext)]
A
Alex Crichton 已提交
40 41
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
42
#![feature(rustc_private)]
T
Fallout  
Tamir Duberstein 已提交
43
#![feature(slice_patterns)]
A
Alex Crichton 已提交
44
#![feature(staged_api)]
45
#![feature(std_misc)]
46
#![feature(str_char)]
47
#![cfg_attr(test, feature(test))]
48

N
Nick Cameron 已提交
49
#![allow(trivial_casts)]
N
Nick Cameron 已提交
50

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

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

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

72 73
pub use rustc_llvm as llvm;

74 75 76
#[macro_use]
mod macros;

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

81 82
pub mod back {
    pub use rustc_back::abi;
83
    pub use rustc_back::archive;
84 85 86
    pub use rustc_back::arm;
    pub use rustc_back::mips;
    pub use rustc_back::mipsel;
87
    pub use rustc_back::rpath;
88 89 90 91 92 93
    pub use rustc_back::svh;
    pub use rustc_back::target_strs;
    pub use rustc_back::x86;
    pub use rustc_back::x86_64;
}

94
pub mod middle {
95
    pub mod astconv_util;
96 97 98
    pub mod astencode;
    pub mod cfg;
    pub mod check_const;
99
    pub mod check_static_recursion;
100 101
    pub mod check_loop;
    pub mod check_match;
N
Nick Cameron 已提交
102
    pub mod check_rvalues;
103
    pub mod const_eval;
N
Niko Matsakis 已提交
104
    pub mod dataflow;
105 106 107 108 109 110
    pub mod dead;
    pub mod def;
    pub mod dependency_format;
    pub mod effect;
    pub mod entry;
    pub mod expr_use_visitor;
111
    pub mod fast_reject;
112
    pub mod free_region;
113
    pub mod intrinsicck;
114
    pub mod infer;
115
    pub mod implicator;
116
    pub mod lang_items;
117 118 119
    pub mod liveness;
    pub mod mem_categorization;
    pub mod pat_util;
120
    pub mod privacy;
121
    pub mod reachable;
122
    pub mod region;
123
    pub mod recursion_limit;
124
    pub mod resolve_lifetime;
A
Aaron Turon 已提交
125
    pub mod stability;
126
    pub mod subst;
127
    pub mod traits;
128 129
    pub mod ty;
    pub mod ty_fold;
130
    pub mod ty_match;
131
    pub mod ty_relate;
132
    pub mod ty_walk;
133
    pub mod weak_lang_items;
134 135
}

136
pub mod metadata;
137

138
pub mod session;
G
Graydon Hoare 已提交
139

K
Keegan McAllister 已提交
140
pub mod plugin;
141

K
Keegan McAllister 已提交
142 143
pub mod lint;

144
pub mod util {
145
    pub use rustc_back::sha2;
146

147 148
    pub mod common;
    pub mod ppaux;
149
    pub mod nodemap;
A
Alex Crichton 已提交
150
    pub mod lev_distance;
151
    pub mod num;
152
    pub mod fs;
G
Graydon Hoare 已提交
153 154
}

155
pub mod lib {
156
    pub use llvm;
G
Graydon Hoare 已提交
157 158
}

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

// Build the diagnostics array at the end so that the metadata includes error use sites.
#[cfg(stage0)]
__build_diagnostic_array! { DIAGNOSTICS }
#[cfg(not(stage0))]
__build_diagnostic_array! { librustc, DIAGNOSTICS }