]> git.lizzy.rs Git - rust.git/blob - src/librustc_trans/lib.rs
rustdoc: Hide `self: Box<Self>` in list of deref methods
[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 #![crate_type = "dylib"]
19 #![crate_type = "rlib"]
20 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
21       html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
22       html_root_url = "https://doc.rust-lang.org/nightly/")]
23 #![deny(warnings)]
24
25 #![feature(associated_consts)]
26 #![feature(box_patterns)]
27 #![feature(box_syntax)]
28 #![feature(const_fn)]
29 #![feature(custom_attribute)]
30 #![allow(unused_attributes)]
31 #![feature(i128_type)]
32 #![feature(libc)]
33 #![feature(quote)]
34 #![feature(rustc_diagnostic_macros)]
35 #![feature(slice_patterns)]
36 #![feature(unicode)]
37 #![feature(conservative_impl_trait)]
38
39 #![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))]
40 #![cfg_attr(stage0, feature(rustc_private))]
41 #![cfg_attr(stage0, feature(staged_api))]
42
43 use rustc::dep_graph::WorkProduct;
44 use syntax_pos::symbol::Symbol;
45
46 extern crate flate;
47 extern crate libc;
48 extern crate owning_ref;
49 #[macro_use] extern crate rustc;
50 extern crate rustc_back;
51 extern crate rustc_data_structures;
52 extern crate rustc_incremental;
53 pub extern crate rustc_llvm as llvm;
54 extern crate rustc_platform_intrinsics as intrinsics;
55 extern crate rustc_const_math;
56 #[macro_use]
57 #[no_link]
58 extern crate rustc_bitflags;
59
60 #[macro_use] extern crate log;
61 #[macro_use] extern crate syntax;
62 extern crate syntax_pos;
63 extern crate rustc_errors as errors;
64 extern crate serialize;
65
66 pub use base::trans_crate;
67 pub use back::symbol_names::provide;
68
69 pub use metadata::LlvmMetadataLoader;
70 pub use llvm_util::{init, target_features, print_version, print_passes, print, enable_llvm_debug};
71
72 pub mod back {
73     mod archive;
74     pub(crate) mod linker;
75     pub mod link;
76     mod lto;
77     pub(crate) mod symbol_export;
78     pub(crate) mod symbol_names;
79     pub mod write;
80     mod msvc;
81     mod rpath;
82 }
83
84 mod diagnostics;
85
86 mod abi;
87 mod adt;
88 mod asm;
89 mod assert_module_sources;
90 mod attributes;
91 mod base;
92 mod builder;
93 mod cabi_aarch64;
94 mod cabi_arm;
95 mod cabi_asmjs;
96 mod cabi_hexagon;
97 mod cabi_mips;
98 mod cabi_mips64;
99 mod cabi_msp430;
100 mod cabi_nvptx;
101 mod cabi_nvptx64;
102 mod cabi_powerpc;
103 mod cabi_powerpc64;
104 mod cabi_s390x;
105 mod cabi_sparc;
106 mod cabi_sparc64;
107 mod cabi_x86;
108 mod cabi_x86_64;
109 mod cabi_x86_win64;
110 mod callee;
111 mod collector;
112 mod common;
113 mod consts;
114 mod context;
115 mod debuginfo;
116 mod declare;
117 mod glue;
118 mod intrinsic;
119 mod llvm_util;
120 mod machine;
121 mod metadata;
122 mod meth;
123 mod mir;
124 mod monomorphize;
125 mod partitioning;
126 mod symbol_names_test;
127 mod trans_item;
128 mod tvec;
129 mod type_;
130 mod type_of;
131 mod value;
132
133 #[derive(Clone)]
134 pub struct ModuleTranslation {
135     /// The name of the module. When the crate may be saved between
136     /// compilations, incremental compilation requires that name be
137     /// unique amongst **all** crates.  Therefore, it should contain
138     /// something unique to this crate (e.g., a module path) as well
139     /// as the crate name and disambiguator.
140     pub name: String,
141     pub symbol_name_hash: u64,
142     pub source: ModuleSource,
143 }
144
145 #[derive(Clone)]
146 pub enum ModuleSource {
147     /// Copy the `.o` files or whatever from the incr. comp. directory.
148     Preexisting(WorkProduct),
149
150     /// Rebuild from this LLVM module.
151     Translated(ModuleLlvm),
152 }
153
154 #[derive(Copy, Clone)]
155 pub struct ModuleLlvm {
156     pub llcx: llvm::ContextRef,
157     pub llmod: llvm::ModuleRef,
158 }
159
160 unsafe impl Send for ModuleTranslation { }
161 unsafe impl Sync for ModuleTranslation { }
162
163 pub struct CrateTranslation {
164     pub crate_name: Symbol,
165     pub modules: Vec<ModuleTranslation>,
166     pub metadata_module: ModuleTranslation,
167     pub link: rustc::middle::cstore::LinkMeta,
168     pub metadata: rustc::middle::cstore::EncodedMetadata,
169     pub exported_symbols: back::symbol_export::ExportedSymbols,
170     pub no_builtins: bool,
171     pub windows_subsystem: Option<String>,
172     pub linker_info: back::linker::LinkerInfo
173 }
174
175 __build_diagnostic_array! { librustc_trans, DIAGNOSTICS }