2013-02-28 07:15:32 -06:00
|
|
|
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
|
2012-12-03 18:48:01 -06:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2014-05-12 17:30:24 -05:00
|
|
|
#![crate_id = "rustc#0.11.0-pre"]
|
2014-03-21 20:05:05 -05:00
|
|
|
#![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-05-21 21:55:39 -05:00
|
|
|
html_root_url = "http://doc.rust-lang.org/")]
|
2011-05-05 21:44:00 -05:00
|
|
|
|
2014-03-21 20:05:05 -05:00
|
|
|
#![allow(deprecated)]
|
|
|
|
#![feature(macro_rules, globs, struct_variant, managed_boxes, quote,
|
|
|
|
default_type_params, phase)]
|
2013-08-14 20:41:40 -05:00
|
|
|
|
2014-02-14 12:10:06 -06:00
|
|
|
extern crate arena;
|
2014-05-22 13:28:01 -05:00
|
|
|
extern crate debug;
|
|
|
|
extern crate flate;
|
|
|
|
extern crate getopts;
|
2014-04-17 14:00:08 -05:00
|
|
|
extern crate graphviz;
|
2014-05-22 13:28:01 -05:00
|
|
|
extern crate libc;
|
2014-02-14 12:10:06 -06:00
|
|
|
extern crate serialize;
|
2014-05-22 13:28:01 -05:00
|
|
|
extern crate syntax;
|
2014-02-19 21:08:12 -06:00
|
|
|
extern crate time;
|
2014-02-26 11:58:41 -06:00
|
|
|
|
2014-05-24 23:15:16 -05:00
|
|
|
#[cfg(stage0)]
|
log: Introduce liblog, the old std::logging
This commit moves all logging out of the standard library into an external
crate. This crate is the new crate which is responsible for all logging macros
and logging implementation. A few reasons for this change are:
* The crate map has always been a bit of a code smell among rust programs. It
has difficulty being loaded on almost all platforms, and it's used almost
exclusively for logging and only logging. Removing the crate map is one of the
end goals of this movement.
* The compiler has a fair bit of special support for logging. It has the
__log_level() expression as well as generating a global word per module
specifying the log level. This is unfairly favoring the built-in logging
system, and is much better done purely in libraries instead of the compiler
itself.
* Initialization of logging is much easier to do if there is no reliance on a
magical crate map being available to set module log levels.
* If the logging library can be written outside of the standard library, there's
no reason that it shouldn't be. It's likely that we're not going to build the
highest quality logging library of all time, so third-party libraries should
be able to provide just as high-quality logging systems as the default one
provided in the rust distribution.
With a migration such as this, the change does not come for free. There are some
subtle changes in the behavior of liblog vs the previous logging macros:
* The core change of this migration is that there is no longer a physical
log-level per module. This concept is still emulated (it is quite useful), but
there is now only a global log level, not a local one. This global log level
is a reflection of the maximum of all log levels specified. The previously
generated logging code looked like:
if specified_level <= __module_log_level() {
println!(...)
}
The newly generated code looks like:
if specified_level <= ::log::LOG_LEVEL {
if ::log::module_enabled(module_path!()) {
println!(...)
}
}
Notably, the first layer of checking is still intended to be "super fast" in
that it's just a load of a global word and a compare. The second layer of
checking is executed to determine if the current module does indeed have
logging turned on.
This means that if any module has a debug log level turned on, all modules
with debug log levels get a little bit slower (they all do more expensive
dynamic checks to determine if they're turned on or not).
Semantically, this migration brings no change in this respect, but
runtime-wise, this will have a perf impact on some code.
* A `RUST_LOG=::help` directive will no longer print out a list of all modules
that can be logged. This is because the crate map will no longer specify the
log levels of all modules, so the list of modules is not known. Additionally,
warnings can no longer be provided if a malformed logging directive was
supplied.
The new "hello world" for logging looks like:
#[phase(syntax, link)]
extern crate log;
fn main() {
debug!("Hello, world!");
}
2014-03-09 00:11:44 -06:00
|
|
|
#[phase(syntax, link)]
|
|
|
|
extern crate log;
|
2013-03-26 21:53:33 -05:00
|
|
|
|
2014-05-24 23:15:16 -05:00
|
|
|
#[cfg(not(stage0))]
|
|
|
|
#[phase(plugin, link)]
|
|
|
|
extern crate log;
|
|
|
|
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod middle {
|
2014-05-14 14:31:30 -05:00
|
|
|
pub mod def;
|
2013-06-12 18:18:58 -05:00
|
|
|
pub mod trans;
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod ty;
|
2013-10-29 05:03:32 -05:00
|
|
|
pub mod ty_fold;
|
Cleanup substitutions and treatment of generics around traits in a number of ways.
- In a TraitRef, use the self type consistently to refer to the Self type:
- trait ref in `impl Trait<A,B,C> for S` has a self type of `S`.
- trait ref in `A:Trait` has the self type `A`
- trait ref associated with a trait decl has self type `Self`
- trait ref associated with a supertype has self type `Self`
- trait ref in an object type `@Trait` has no self type
- Rewrite `each_bound_traits_and_supertraits` to perform
substitutions as it goes, and thus yield a series of trait refs
that are always in the same 'namespace' as the type parameter
bound given as input. Before, we left this to the caller, but
this doesn't work because the caller lacks adequare information
to perform the type substitutions correctly.
- For provided methods, substitute the generics involved in the provided
method correctly.
- Introduce TypeParameterDef, which tracks the bounds declared on a type
parameter and brings them together with the def_id and (in the future)
other information (maybe even the parameter's name!).
- Introduce Subst trait, which helps to cleanup a lot of the
repetitive code involved with doing type substitution.
- Introduce Repr trait, which makes debug printouts far more convenient.
Fixes #4183. Needed for #5656.
2013-04-09 00:54:49 -05:00
|
|
|
pub mod subst;
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod resolve;
|
2013-10-29 05:03:32 -05:00
|
|
|
pub mod resolve_lifetime;
|
2012-11-28 14:33:00 -06:00
|
|
|
pub mod typeck;
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod check_loop;
|
|
|
|
pub mod check_match;
|
|
|
|
pub mod check_const;
|
2014-02-26 12:22:41 -06:00
|
|
|
pub mod check_static;
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod lint;
|
2012-12-13 15:05:22 -06:00
|
|
|
pub mod borrowck;
|
2013-04-17 17:05:17 -05:00
|
|
|
pub mod dataflow;
|
2013-01-29 17:16:07 -06:00
|
|
|
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;
|
2013-04-29 16:56:05 -05:00
|
|
|
pub mod entry;
|
2013-05-23 21:12:16 -05:00
|
|
|
pub mod effect;
|
2013-06-14 20:21:47 -05:00
|
|
|
pub mod reachable;
|
2013-05-09 10:29:17 -05:00
|
|
|
pub mod graph;
|
2013-05-10 12:10:35 -05:00
|
|
|
pub mod cfg;
|
2013-12-08 01:55:27 -06:00
|
|
|
pub mod dead;
|
2014-04-21 18:21:53 -05:00
|
|
|
pub mod expr_use_visitor;
|
2014-05-02 02:59:27 -05:00
|
|
|
pub mod dependency_format;
|
2014-05-19 11:30:09 -05:00
|
|
|
pub mod weak_lang_items;
|
2011-04-19 18:40:46 -05:00
|
|
|
}
|
|
|
|
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod front {
|
|
|
|
pub mod config;
|
|
|
|
pub mod test;
|
2013-05-17 15:12:42 -05:00
|
|
|
pub mod std_inject;
|
2014-01-06 06:00:46 -06:00
|
|
|
pub mod assign_node_ids_and_map;
|
2013-10-02 20:10:16 -05:00
|
|
|
pub mod feature_gate;
|
2014-02-07 04:50:07 -06:00
|
|
|
pub mod show_span;
|
2010-06-23 23:03:09 -05:00
|
|
|
}
|
|
|
|
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod back {
|
|
|
|
pub mod abi;
|
2014-02-24 21:45:20 -06:00
|
|
|
pub mod archive;
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod arm;
|
2014-02-24 21:45:20 -06:00
|
|
|
pub mod link;
|
|
|
|
pub mod lto;
|
2013-01-29 08:28:08 -06:00
|
|
|
pub mod mips;
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod rpath;
|
2014-02-24 21:45:20 -06:00
|
|
|
pub mod svh;
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod target_strs;
|
2014-02-24 21:45:20 -06:00
|
|
|
pub mod x86;
|
|
|
|
pub mod x86_64;
|
2010-09-23 17:46:31 -05:00
|
|
|
}
|
|
|
|
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod metadata;
|
2011-06-27 18:38:57 -05:00
|
|
|
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod driver;
|
2010-06-23 23:03:09 -05:00
|
|
|
|
2014-05-26 16:48:54 -05:00
|
|
|
pub mod plugin;
|
2014-05-24 18:16:10 -05:00
|
|
|
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod util {
|
|
|
|
pub mod common;
|
|
|
|
pub mod ppaux;
|
2013-12-09 15:56:53 -06:00
|
|
|
pub mod sha2;
|
2014-02-28 16:34:26 -06:00
|
|
|
pub mod nodemap;
|
2014-04-08 12:06:11 -05:00
|
|
|
pub mod fs;
|
2010-08-18 13:34:47 -05:00
|
|
|
}
|
|
|
|
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod lib {
|
|
|
|
pub mod llvm;
|
2013-11-30 22:52:21 -06:00
|
|
|
pub mod llvmdeps;
|
2010-07-12 19:47:40 -05:00
|
|
|
}
|
|
|
|
|
2013-01-29 17:16:07 -06:00
|
|
|
pub fn main() {
|
2014-05-14 23:39:11 -05:00
|
|
|
let args = std::os::args().iter()
|
2014-05-25 05:17:19 -05:00
|
|
|
.map(|x| x.to_string())
|
2014-05-14 23:39:11 -05:00
|
|
|
.collect::<Vec<_>>();
|
|
|
|
std::os::set_exit_status(driver::main_args(args.as_slice()));
|
2013-08-22 04:41:33 -05:00
|
|
|
}
|