Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Replace removed run_compiler function
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Oct 12, 2020
1 parent 95d0d9f commit 1f686d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 5 additions & 3 deletions rls-rustc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extern crate rustc_span;

#[cfg(feature = "ipc")]
use rustc_driver::Compilation;
use rustc_driver::{run_compiler, Callbacks};
use rustc_driver::{Callbacks, RunCompiler};
use rustc_interface::interface;
#[cfg(feature = "ipc")]
use rustc_interface::Queries;
Expand Down Expand Up @@ -75,8 +75,10 @@ pub fn run() -> Result<(), ()> {
};

rustc_driver::install_ice_hook();
rustc_driver::catch_fatal_errors(|| {
run_compiler(&args, &mut shim_calls, file_loader, None, None)
rustc_driver::catch_fatal_errors(move || {
let mut compiler = RunCompiler::new(&args, &mut shim_calls);
compiler.set_file_loader(file_loader);
compiler.run()
})
.map(|_| ())
.map_err(|_| ())
Expand Down
16 changes: 7 additions & 9 deletions rls/src/build/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use log::trace;
use rls_data::Analysis;
use rls_vfs::Vfs;

use self::rustc_driver::{run_compiler, Compilation};
use self::rustc_driver::{Compilation, RunCompiler};
use self::rustc_interface::interface;
use self::rustc_interface::Queries;
use self::rustc_save_analysis as save;
Expand Down Expand Up @@ -185,14 +185,12 @@ fn run_in_process(
let stderr = Arc::clone(&stderr);
|| {
rustc_driver::catch_fatal_errors(move || {
// Replace stderr so we catch most errors.
run_compiler(
&args,
&mut callbacks,
Some(Box::new(ReplacedFileLoader::new(changed))),
Some(Box::new(BufWriter(stderr))),
None,
)
let mut compiler = RunCompiler::new(&args, &mut callbacks);
compiler
.set_file_loader(Some(Box::new(ReplacedFileLoader::new(changed))))
// Replace stderr so we catch most errors.
.set_emitter(Some(Box::new(BufWriter(stderr))));
compiler.run()
})
}
})
Expand Down

0 comments on commit 1f686d5

Please sign in to comment.