rust/src/librustc/lib.rs

155 lines
3.4 KiB
Rust
Raw Normal View History

2013-02-28 07:15:32 -06:00
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// 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.
2014-01-07 23:17:52 -06:00
/*!
The Rust compiler.
# Note
This API is completely unstable and subject to change.
*/
#![crate_name = "rustc"]
#![experimental]
#![comment = "The Rust compiler"]
#![license = "MIT/ASL2"]
#![crate_type = "dylib"]
#![crate_type = "rlib"]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2014-01-07 23:17:52 -06:00
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2014-07-11 13:21:57 -05:00
html_root_url = "http://doc.rust-lang.org/master/")]
2011-05-05 21:44:00 -05:00
#![allow(deprecated)]
#![feature(macro_rules, globs, struct_variant, managed_boxes, quote)]
#![feature(default_type_params, phase, unsafe_destructor)]
#![allow(unknown_features)] // NOTE: Remove after next snapshot
#![feature(rustc_diagnostic_macros)]
extern crate arena;
extern crate debug;
extern crate flate;
extern crate getopts;
extern crate graphviz;
extern crate libc;
2014-07-05 15:24:57 -05:00
extern crate llvm = "rustc_llvm";
2014-07-04 21:41:54 -05:00
extern crate rustc_back = "rustc_back";
extern crate serialize;
2014-02-19 21:08:12 -06:00
extern crate time;
2014-06-11 20:47:09 -05:00
#[phase(plugin, link)] extern crate log;
#[phase(plugin, link)] extern crate syntax;
mod diagnostics;
2014-07-04 21:41:54 -05:00
pub mod back {
pub use rustc_back::abi;
2014-07-06 23:50:37 -05:00
pub use rustc_back::archive;
2014-07-04 21:41:54 -05:00
pub use rustc_back::arm;
pub use rustc_back::mips;
pub use rustc_back::mipsel;
2014-07-06 20:01:16 -05:00
pub use rustc_back::rpath;
2014-07-04 21:41:54 -05:00
pub use rustc_back::svh;
pub use rustc_back::target_strs;
pub use rustc_back::x86;
pub use rustc_back::x86_64;
pub mod link;
pub mod lto;
}
>>>>>>> Extract librustc_back from librustc
pub mod middle {
pub mod def;
2013-06-12 18:18:58 -05:00
pub mod trans;
pub mod ty;
pub mod ty_fold;
pub mod subst;
pub mod resolve;
pub mod resolve_lifetime;
2012-11-28 14:33:00 -06:00
pub mod typeck;
pub mod check_loop;
pub mod check_match;
pub mod check_const;
pub mod check_static;
pub mod borrowck;
2013-04-17 17:05:17 -05:00
pub mod dataflow;
pub mod mem_categorization;
pub mod liveness;
pub mod kind;
pub mod freevars;
pub mod pat_util;
pub mod region;
pub mod const_eval;
pub mod astencode;
pub mod lang_items;
pub mod privacy;
pub mod entry;
pub mod effect;
pub mod reachable;
pub mod graph;
pub mod cfg;
2013-12-08 01:55:27 -06:00
pub mod dead;
pub mod expr_use_visitor;
pub mod dependency_format;
rustc: Add official support for weak failure This commit is part of the ongoing libstd facade efforts (cc #13851). The compiler now recognizes some language items as "extern { fn foo(...); }" and will automatically perform the following actions: 1. The foreign function has a pre-defined name. 2. The crate and downstream crates can only be built as rlibs until a crate defines the lang item itself. 3. The actual lang item has a pre-defined name. This is essentially nicer compiler support for the hokey core-depends-on-std-failure scheme today, but it is implemented the same way. The details are a little more hidden under the covers. In addition to failure, this commit promotes the eh_personality and rust_stack_exhausted functions to official lang items. The compiler can generate calls to these functions, causing linkage errors if they are left undefined. The checking for these items is not as precise as it could be. Crates compiling with `-Z no-landing-pads` will not need the eh_personality lang item, and crates compiling with no split stacks won't need the stack exhausted lang item. For ease, however, these items are checked for presence in all final outputs of the compiler. It is quite easy to define dummy versions of the functions necessary: #[lang = "stack_exhausted"] extern fn stack_exhausted() { /* ... */ } #[lang = "eh_personality"] extern fn eh_personality() { /* ... */ } cc #11922, rust_stack_exhausted is now a lang item cc #13851, libcollections is blocked on eh_personality becoming weak
2014-05-19 11:30:09 -05:00
pub mod weak_lang_items;
pub mod save;
pub mod intrinsicck;
pub mod stability;
2011-04-19 18:40:46 -05:00
}
pub mod front {
pub mod config;
pub mod test;
pub mod std_inject;
2014-01-06 06:00:46 -06:00
pub mod assign_node_ids_and_map;
pub mod feature_gate;
2014-02-07 04:50:07 -06:00
pub mod show_span;
2010-06-23 23:03:09 -05:00
}
pub mod metadata;
pub mod driver;
2010-06-23 23:03:09 -05:00
2014-05-26 16:48:54 -05:00
pub mod plugin;
pub mod lint;
pub mod util {
2014-07-07 00:13:55 -05:00
pub use rustc_back::fs;
pub mod common;
pub mod ppaux;
pub mod sha2;
pub mod nodemap;
2010-08-18 13:34:47 -05:00
}
pub mod lib {
2014-07-05 15:24:57 -05:00
pub use llvm;
2010-07-12 19:47:40 -05:00
}
__build_diagnostic_array!(DIAGNOSTICS)
// 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;
}
pub fn main() {
let args = std::os::args();
std::os::set_exit_status(driver::main_args(args.as_slice()));
}