diff --git a/Cargo.lock b/Cargo.lock index b685d3e2814..a24e788811e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1439,7 +1439,7 @@ dependencies = [ "rls-analysis 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)", "rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rls-data 0.18.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-rustc 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-rustc 0.6.0", "rls-span 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rls-vfs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1492,8 +1492,7 @@ dependencies = [ [[package]] name = "rls-rustc" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "0.6.0" [[package]] name = "rls-span" @@ -2464,7 +2463,6 @@ dependencies = [ "checksum rls-analysis 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ae18d8ad01dec3b2014f4d7ae3c607d7adbcff79e5d3b48ea42ea71c10d43a71" "checksum rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ce1fdac03e138c4617ff87b194e1ff57a39bb985a044ccbd8673d30701e411" "checksum rls-data 0.18.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5f80b84551b32e26affaf7f12374913b5061730c0dcd185d9e8fa5a15e36e65c" -"checksum rls-rustc 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9dba7390427aefa953608429701e3665192ca810ba8ae09301e001b7c7bed0" "checksum rls-span 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "33d66f1d6c6ccd5c98029f162544131698f6ebb61d8c697681cac409dcd08805" "checksum rls-vfs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "74698a8492cdc0c378e6a5e4c5ed27a2a32bf708ce0297931801238baba898a9" "checksum rustc-ap-arena 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8be999235b541fc8eb54901b66e899a06076709ac5f53d6b2c5c59d29ad54780" diff --git a/Cargo.toml b/Cargo.toml index cbe371f328a..bec1f5088ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,8 @@ path = "rls/src/main.rs" rls-analysis = "0.16.12" rls-blacklist = "0.1.3" rls-data = { version = "0.18.2", features = ["serialize-serde", "serialize-rustc"] } -rls-rustc = "0.5.0" +# FIXME: Release rls-rustc 0.6.0 to crates.io +rls-rustc = { version = "0.6.0", path = "rls-rustc" } rls-span = { version = "0.4", features = ["serialize-serde"] } rls-vfs = "0.7" diff --git a/rls-rustc/Cargo.toml b/rls-rustc/Cargo.toml index 553086f0cf7..82c6ea16b26 100644 --- a/rls-rustc/Cargo.toml +++ b/rls-rustc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rls-rustc" -version = "0.5.0" +version = "0.6.0" authors = ["Nick Cameron "] description = "A simple shim around rustc to allow using save-analysis with a stable toolchain" license = "Apache-2.0/MIT" diff --git a/rls-rustc/src/lib.rs b/rls-rustc/src/lib.rs index b3f4800bb3d..3293870633f 100644 --- a/rls-rustc/src/lib.rs +++ b/rls-rustc/src/lib.rs @@ -6,26 +6,21 @@ extern crate rustc; extern crate rustc_codegen_utils; extern crate rustc_driver; extern crate rustc_errors; +extern crate rustc_interface; extern crate rustc_metadata; extern crate syntax; -use rustc::session::config::{self, ErrorOutputType, Input}; -use rustc::session::{early_error, Session}; -use rustc_codegen_utils::codegen_backend::CodegenBackend; -use rustc_driver::driver::CompileController; -use rustc_driver::{ - enable_save_analysis, run_compiler, Compilation, CompilerCalls, RustcDefaultCalls, -}; -use rustc_metadata::cstore::CStore; -use syntax::ast; +use rustc::session::config::ErrorOutputType; +use rustc::session::early_error; +use rustc_driver::{run_compiler, Callbacks}; +use rustc_interface::interface; use std::env; -use std::path::PathBuf; use std::process; pub fn run() { drop(env_logger::init()); - let result = rustc_driver::run(|| { + let result = rustc_driver::report_ices_to_stderr_if_any(|| { let args = env::args_os() .enumerate() .map(|(i, arg)| { @@ -38,64 +33,17 @@ pub fn run() { }) .collect::>(); - run_compiler(&args, Box::new(ShimCalls), None, None) - }); - process::exit(result as i32); + run_compiler(&args, &mut ShimCalls, None, None) + }) + .and_then(|result| result); + process::exit(result.is_err() as i32); } struct ShimCalls; -impl<'a> CompilerCalls<'a> for ShimCalls { - fn early_callback( - &mut self, - a: &getopts::Matches, - b: &config::Options, - c: &ast::CrateConfig, - d: &rustc_errors::registry::Registry, - e: ErrorOutputType, - ) -> Compilation { - RustcDefaultCalls.early_callback(a, b, c, d, e) - } - - fn late_callback( - &mut self, - a: &CodegenBackend, - b: &getopts::Matches, - c: &Session, - d: &CStore, - e: &Input, - f: &Option, - g: &Option, - ) -> Compilation { - RustcDefaultCalls.late_callback(a, b, c, d, e, f, g) - } - - fn some_input(&mut self, a: Input, b: Option) -> (Input, Option) { - RustcDefaultCalls.some_input(a, b) - } - - fn no_input( - &mut self, - a: &getopts::Matches, - b: &config::Options, - c: &ast::CrateConfig, - d: &Option, - e: &Option, - f: &rustc_errors::registry::Registry, - ) -> Option<(Input, Option)> { - RustcDefaultCalls.no_input(a, b, c, d, e, f) - } - - fn build_controller( - self: Box, - a: &Session, - b: &getopts::Matches, - ) -> CompileController<'a> { - let mut result = Box::new(RustcDefaultCalls).build_controller(a, b); - - result.continue_parse_after_error = true; - enable_save_analysis(&mut result); - - result +impl Callbacks for ShimCalls { + fn config(&mut self, config: &mut interface::Config) { + config.opts.debugging_opts.continue_parse_after_error = true; + config.opts.debugging_opts.save_analysis = true; } }