diff --git a/mk/crates.mk b/mk/crates.mk index 839631f02ab634547a53a7184b9470cca4252f8c..3a2def389cc24e92e907ad9fbcdf9e5c56393d35 100644 --- a/mk/crates.mk +++ b/mk/crates.mk @@ -53,8 +53,8 @@ TARGET_CRATES := libc std flate arena term \ serialize getopts collections test time rand \ log regex graphviz core rbml alloc rustrt \ unicode -HOST_CRATES := syntax rustc rustc_typeck rustc_trans rustdoc regex_macros fmt_macros \ - rustc_llvm rustc_back +RUSTC_CRATES := rustc rustc_typeck rustc_driver rustc_trans rustc_back rustc_llvm +HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc regex_macros fmt_macros CRATES := $(TARGET_CRATES) $(HOST_CRATES) TOOLS := compiletest rustdoc rustc @@ -67,14 +67,16 @@ DEPS_std := core libc rand alloc collections rustrt unicode \ native:rust_builtin native:backtrace DEPS_graphviz := std DEPS_syntax := std term serialize log fmt_macros arena libc +DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back \ + rustc_typeck log syntax serialize rustc_llvm rustc_trans DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \ - rustc_typeck log syntax serialize rustc_llvm + log syntax serialize rustc_llvm DEPS_rustc_typeck := rustc syntax DEPS_rustc := syntax flate arena serialize getopts rbml \ time log graphviz rustc_llvm rustc_back DEPS_rustc_llvm := native:rustllvm libc std DEPS_rustc_back := std syntax rustc_llvm flate log libc -DEPS_rustdoc := rustc rustc_trans native:hoedown serialize getopts \ +DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \ test time DEPS_flate := std native:miniz DEPS_arena := std @@ -96,7 +98,7 @@ DEPS_fmt_macros = std TOOL_DEPS_compiletest := test getopts TOOL_DEPS_rustdoc := rustdoc -TOOL_DEPS_rustc := rustc_trans +TOOL_DEPS_rustc := rustc_driver TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs TOOL_SOURCE_rustc := $(S)src/driver/driver.rs @@ -115,8 +117,9 @@ ONLY_RLIB_unicode := 1 DOC_CRATES := $(filter-out rustc, \ $(filter-out rustc_trans, \ $(filter-out rustc_typeck, \ - $(filter-out syntax, $(CRATES))))) -COMPILER_DOC_CRATES := rustc rustc_trans rustc_typeck syntax + $(filter-out rustc_driver, \ + $(filter-out syntax, $(CRATES)))))) +COMPILER_DOC_CRATES := rustc rustc_trans rustc_typeck rustc_driver syntax # This macro creates some simple definitions for each crate being built, just # some munging of all of the parameters above. diff --git a/src/driver/driver.rs b/src/driver/driver.rs index 632d21d7b9c05deea379d824054e8b81516fa14e..5c29cb4ec72760f3813ff1270b1c8b93d8005a58 100644 --- a/src/driver/driver.rs +++ b/src/driver/driver.rs @@ -12,6 +12,6 @@ extern crate "rustdoc" as this; #[cfg(rustc)] -extern crate "rustc_trans" as this; +extern crate "rustc_driver" as this; fn main() { this::main() } diff --git a/src/librustc_trans/driver/driver.rs b/src/librustc_driver/driver.rs similarity index 98% rename from src/librustc_trans/driver/driver.rs rename to src/librustc_driver/driver.rs index f7cdc7de56088bdc3ab86b0d976950327d5d74ee..437b0257a9759f18e3500ec0a79f23ba7a639d23 100644 --- a/src/librustc_trans/driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -8,22 +8,22 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use back::link; -use back::write; -use session::Session; -use session::config::{mod, Input, OutputFilenames}; -use lint; -use metadata::creader; -use middle::{stability, ty, reachable}; -use middle::dependency_format; -use middle; -use plugin::load::Plugins; -use plugin::registry::Registry; -use plugin; +use rustc::session::Session; +use rustc::session::config::{mod, Input, OutputFilenames}; +use rustc::lint; +use rustc::metadata::creader; +use rustc::middle::{stability, ty, reachable}; +use rustc::middle::dependency_format; +use rustc::middle; +use rustc::plugin::load::Plugins; +use rustc::plugin::registry::Registry; +use rustc::plugin; +use rustc::util::common::time; +use rustc_trans::back::link; +use rustc_trans::back::write; +use rustc_trans::save; +use rustc_trans::trans; use rustc_typeck as typeck; -use trans; - -use util::common::time; use serialize::{json, Encodable}; @@ -31,7 +31,6 @@ use std::io::fs; use std::os; use arena::TypedArena; -use save; use syntax::ast; use syntax::ast_map; use syntax::attr; diff --git a/src/librustc_trans/driver/mod.rs b/src/librustc_driver/lib.rs similarity index 92% rename from src/librustc_trans/driver/mod.rs rename to src/librustc_driver/lib.rs index dc450ac5f3814d21411814efbcf3e8e3f76ea6a4..efad07005b9b908a93d2ec4ce8da036005c39d3d 100644 --- a/src/librustc_trans/driver/mod.rs +++ b/src/librustc_driver/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,15 +8,46 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub use syntax::diagnostic; +//! The Rust compiler. +//! +//! # Note +//! +//! This API is completely unstable and subject to change. + +#![crate_name = "rustc_driver"] +#![experimental] +#![crate_type = "dylib"] +#![crate_type = "rlib"] +#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", + html_favicon_url = "http://www.rust-lang.org/favicon.ico", + html_root_url = "http://doc.rust-lang.org/nightly/")] + +#![feature(default_type_params, globs, if_let, import_shadowing, macro_rules, phase, quote)] +#![feature(slicing_syntax, unsafe_destructor)] +#![feature(rustc_diagnostic_macros)] + +extern crate arena; +extern crate flate; +extern crate getopts; +extern crate graphviz; +extern crate libc; +extern crate rustc; +extern crate rustc_typeck; +extern crate rustc_back; +extern crate rustc_trans; +#[phase(plugin, link)] extern crate log; +#[phase(plugin, link)] extern crate syntax; +extern crate serialize; +extern crate "rustc_llvm" as llvm; -use back::link; -use session::{config, Session, build_session}; -use session::config::Input; -use lint::Lint; -use lint; -use metadata; +pub use syntax::diagnostic; +use rustc_trans::back::link; +use rustc::session::{config, Session, build_session}; +use rustc::session::config::Input; +use rustc::lint::Lint; +use rustc::lint; +use rustc::metadata; use rustc::DIAGNOSTICS; use std::any::AnyRefExt; @@ -24,14 +55,15 @@ use std::os; use std::task::TaskBuilder; -use session::early_error; +use rustc::session::early_error; use syntax::ast; use syntax::parse; use syntax::diagnostic::Emitter; use syntax::diagnostics; -use getopts; +#[cfg(test)] +pub mod test; pub mod driver; pub mod pretty; @@ -507,3 +539,9 @@ pub fn monitor(f: proc():Send) { } } +pub fn main() { + let args = std::os::args(); + let result = run(args); + std::os::set_exit_status(result); +} + diff --git a/src/librustc_driver/mod.rs b/src/librustc_driver/mod.rs new file mode 100644 index 0000000000000000000000000000000000000000..1fbbc9c05213b3966aea81484bd6a7c7add3bf3d --- /dev/null +++ b/src/librustc_driver/mod.rs @@ -0,0 +1,10 @@ +// Copyright 2012 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + diff --git a/src/librustc_trans/driver/pretty.rs b/src/librustc_driver/pretty.rs similarity index 98% rename from src/librustc_trans/driver/pretty.rs rename to src/librustc_driver/pretty.rs index ad110cfeafcbc8989c73f8f69cff3cf86950bdd7..b6441ab4944f7da76e7e6ab8bdc6da20f866a173 100644 --- a/src/librustc_trans/driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -15,19 +15,18 @@ pub use self::PpMode::*; use self::NodesMatchingUII::*; -use back::link; - -use session::Session; -use session::config::{mod, Input}; -use driver::driver::{mod}; - -use middle::ty; -use middle::borrowck::{mod, FnPartsWithCFG}; -use middle::borrowck::graphviz as borrowck_dot; -use middle::cfg; -use middle::cfg::graphviz::LabelledCFG; - -use util::ppaux; +use rustc_trans::back::link; + +use driver; + +use rustc::middle::ty; +use rustc::middle::borrowck::{mod, FnPartsWithCFG}; +use rustc::middle::borrowck::graphviz as borrowck_dot; +use rustc::middle::cfg; +use rustc::middle::cfg::graphviz::LabelledCFG; +use rustc::session::Session; +use rustc::session::config::{mod, Input}; +use rustc::util::ppaux; use syntax::ast; use syntax::ast_map::{mod, blocks, NodePrinter}; diff --git a/src/librustc_trans/test.rs b/src/librustc_driver/test.rs similarity index 100% rename from src/librustc_trans/test.rs rename to src/librustc_driver/test.rs diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 8070b319f1850c4ec08da23b45f112340a67e2cf..4e25921e0b29bda68f21906847e660d0994a1273 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -32,7 +32,6 @@ extern crate graphviz; extern crate libc; extern crate rustc; -extern crate rustc_typeck; extern crate rustc_back; #[phase(plugin, link)] extern crate log; #[phase(plugin, link)] extern crate syntax; @@ -66,17 +65,7 @@ pub mod back { pub mod trans; pub mod save; -pub mod driver; pub mod lib { pub use llvm; } - -pub fn main() { - let args = std::os::args(); - let result = driver::run(args); - std::os::set_exit_status(result); -} - -#[cfg(test)] -pub mod test; diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 1eb6ba65860a12b61794b166d61e7f21ec020497..4cd88bca51e93a75aa2a4cf8d969cc5b6ecea755 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -9,7 +9,7 @@ // except according to those terms. pub use self::MaybeTyped::*; -use rustc_trans::driver::driver; +use rustc_driver::driver; use rustc::session::{mod, config}; use rustc::middle::{privacy, ty}; use rustc::lint; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index cc946a6ca4a96ea1a956dc952194fb495dadebaa..1e7de50cf879dcf7cdea4eb1227001dff98b0e8f 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -21,6 +21,7 @@ extern crate libc; extern crate rustc; extern crate rustc_trans; +extern crate rustc_driver; extern crate serialize; extern crate syntax; extern crate "test" as testing; @@ -163,7 +164,7 @@ pub fn main_args(args: &[String]) -> int { usage(args[0].as_slice()); return 0; } else if matches.opt_present("version") { - match rustc_trans::driver::version("rustdoc", &matches) { + match rustc_driver::version("rustdoc", &matches) { Some(err) => { println!("{}", err); return 1 diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 8a18c75beddc3d349ed1b071a72767bd00b2cdd0..7ca7ae4b21149ade1afe461deaf8e821a93ea974 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -19,7 +19,7 @@ use std::collections::{HashSet, HashMap}; use testing; use rustc::session::{mod, config}; -use rustc_trans::driver::driver; +use rustc_driver::driver; use syntax::ast; use syntax::codemap::{CodeMap, dummy_spanned}; use syntax::diagnostic;