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.
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.
11 //! The Rust compiler.
15 //! This API is completely unstable and subject to change.
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/")]
26 #![feature(associated_consts)]
27 #![feature(box_patterns)]
28 #![feature(box_syntax)]
30 #![feature(custom_attribute)]
31 #![allow(unused_attributes)]
32 #![feature(i128_type)]
35 #![feature(rustc_diagnostic_macros)]
36 #![feature(rustc_private)]
37 #![feature(slice_patterns)]
38 #![feature(staged_api)]
40 #![feature(conservative_impl_trait)]
42 use rustc::dep_graph::WorkProduct;
43 use syntax_pos::symbol::Symbol;
47 #[macro_use] extern crate rustc;
48 extern crate rustc_back;
49 extern crate rustc_data_structures;
50 extern crate rustc_incremental;
51 pub extern crate rustc_llvm as llvm;
52 extern crate rustc_platform_intrinsics as intrinsics;
53 extern crate rustc_const_math;
56 extern crate rustc_bitflags;
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;
64 pub use rustc::session;
65 pub use rustc::middle;
69 pub use base::trans_crate;
72 pub use rustc::hir::svh;
78 pub mod symbol_export;
93 mod assert_module_sources;
128 mod symbol_names_test;
136 pub struct ModuleTranslation {
137 /// The name of the module. When the crate may be saved between
138 /// compilations, incremental compilation requires that name be
139 /// unique amongst **all** crates. Therefore, it should contain
140 /// something unique to this crate (e.g., a module path) as well
141 /// as the crate name and disambiguator.
143 pub symbol_name_hash: u64,
144 pub source: ModuleSource,
148 pub enum ModuleSource {
149 /// Copy the `.o` files or whatever from the incr. comp. directory.
150 Preexisting(WorkProduct),
152 /// Rebuild from this LLVM module.
153 Translated(ModuleLlvm),
156 #[derive(Copy, Clone)]
157 pub struct ModuleLlvm {
158 pub llcx: llvm::ContextRef,
159 pub llmod: llvm::ModuleRef,
162 unsafe impl Send for ModuleTranslation { }
163 unsafe impl Sync for ModuleTranslation { }
165 pub struct CrateTranslation {
166 pub crate_name: Symbol,
167 pub modules: Vec<ModuleTranslation>,
168 pub metadata_module: ModuleTranslation,
169 pub link: middle::cstore::LinkMeta,
170 pub metadata: middle::cstore::EncodedMetadata,
171 pub exported_symbols: back::symbol_export::ExportedSymbols,
172 pub no_builtins: bool,
173 pub windows_subsystem: Option<String>,
174 pub linker_info: back::linker::LinkerInfo
177 __build_diagnostic_array! { librustc_trans, DIAGNOSTICS }