]> git.lizzy.rs Git - rust.git/blob - src/librustc_trans/lib.rs
Fix invalid associated type rendering in rustdoc
[rust.git] / src / librustc_trans / lib.rs
1 // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! The Rust compiler.
12 //!
13 //! # Note
14 //!
15 //! This API is completely unstable and subject to change.
16
17 #![crate_name = "rustc_trans"]
18 #![unstable(feature = "rustc_private", issue = "27812")]
19 #![crate_type = "dylib"]
20 #![crate_type = "rlib"]
21 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
22       html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
23       html_root_url = "https://doc.rust-lang.org/nightly/")]
24 #![deny(warnings)]
25
26 #![feature(associated_consts)]
27 #![feature(box_patterns)]
28 #![feature(box_syntax)]
29 #![feature(const_fn)]
30 #![feature(custom_attribute)]
31 #![allow(unused_attributes)]
32 #![feature(i128_type)]
33 #![feature(libc)]
34 #![feature(quote)]
35 #![feature(rustc_diagnostic_macros)]
36 #![feature(rustc_private)]
37 #![feature(slice_patterns)]
38 #![feature(staged_api)]
39 #![feature(unicode)]
40 #![feature(conservative_impl_trait)]
41
42 use rustc::dep_graph::WorkProduct;
43
44 extern crate flate;
45 extern crate libc;
46 #[macro_use] extern crate rustc;
47 extern crate rustc_back;
48 extern crate rustc_data_structures;
49 extern crate rustc_incremental;
50 pub extern crate rustc_llvm as llvm;
51 extern crate rustc_platform_intrinsics as intrinsics;
52 extern crate rustc_const_math;
53 extern crate rustc_const_eval;
54 #[macro_use]
55 #[no_link]
56 extern crate rustc_bitflags;
57
58 #[macro_use] extern crate log;
59 #[macro_use] extern crate syntax;
60 extern crate syntax_pos;
61 extern crate rustc_errors as errors;
62 extern crate serialize;
63
64 pub use rustc::session;
65 pub use rustc::middle;
66 pub use rustc::lint;
67 pub use rustc::util;
68
69 pub use base::trans_crate;
70 pub use disr::Disr;
71
72 pub mod back {
73     pub use rustc::hir::svh;
74
75     pub mod archive;
76     pub mod linker;
77     pub mod link;
78     pub mod lto;
79     pub mod symbol_export;
80     pub mod symbol_names;
81     pub mod write;
82     pub mod msvc;
83     pub mod rpath;
84 }
85
86 pub mod diagnostics;
87
88 #[macro_use]
89 mod macros;
90
91 mod abi;
92 mod adt;
93 mod asm;
94 mod assert_module_sources;
95 mod attributes;
96 mod base;
97 mod builder;
98 mod cabi_aarch64;
99 mod cabi_arm;
100 mod cabi_asmjs;
101 mod cabi_mips;
102 mod cabi_mips64;
103 mod cabi_msp430;
104 mod cabi_nvptx;
105 mod cabi_nvptx64;
106 mod cabi_powerpc;
107 mod cabi_powerpc64;
108 mod cabi_s390x;
109 mod cabi_sparc;
110 mod cabi_sparc64;
111 mod cabi_x86;
112 mod cabi_x86_64;
113 mod cabi_x86_win64;
114 mod callee;
115 mod collector;
116 mod common;
117 mod consts;
118 mod context;
119 mod debuginfo;
120 mod declare;
121 mod disr;
122 mod glue;
123 mod intrinsic;
124 mod machine;
125 mod meth;
126 mod mir;
127 mod monomorphize;
128 mod partitioning;
129 mod symbol_map;
130 mod symbol_names_test;
131 mod trans_item;
132 mod tvec;
133 mod type_;
134 mod type_of;
135 mod value;
136
137 #[derive(Clone)]
138 pub struct ModuleTranslation {
139     /// The name of the module. When the crate may be saved between
140     /// compilations, incremental compilation requires that name be
141     /// unique amongst **all** crates.  Therefore, it should contain
142     /// something unique to this crate (e.g., a module path) as well
143     /// as the crate name and disambiguator.
144     pub name: String,
145     pub symbol_name_hash: u64,
146     pub source: ModuleSource,
147 }
148
149 #[derive(Clone)]
150 pub enum ModuleSource {
151     /// Copy the `.o` files or whatever from the incr. comp. directory.
152     Preexisting(WorkProduct),
153
154     /// Rebuild from this LLVM module.
155     Translated(ModuleLlvm),
156 }
157
158 #[derive(Copy, Clone)]
159 pub struct ModuleLlvm {
160     pub llcx: llvm::ContextRef,
161     pub llmod: llvm::ModuleRef,
162 }
163
164 unsafe impl Send for ModuleTranslation { }
165 unsafe impl Sync for ModuleTranslation { }
166
167 pub struct CrateTranslation {
168     pub modules: Vec<ModuleTranslation>,
169     pub metadata_module: ModuleTranslation,
170     pub link: middle::cstore::LinkMeta,
171     pub metadata: Vec<u8>,
172     pub exported_symbols: back::symbol_export::ExportedSymbols,
173     pub no_builtins: bool,
174     pub windows_subsystem: Option<String>,
175     pub linker_info: back::linker::LinkerInfo
176 }
177
178 __build_diagnostic_array! { librustc_trans, DIAGNOSTICS }