Remove RunCompiler
It has become nothing other than a wrapper around run_compiler.
This commit is contained in:
parent
974db1a6e4
commit
a77776cc1d
9 changed files with 16 additions and 32 deletions
|
|
@ -18,7 +18,7 @@ use std::path::Path;
|
|||
|
||||
use rustc_ast_pretty::pprust::item_to_string;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_driver::{Compilation, RunCompiler};
|
||||
use rustc_driver::{Compilation, run_compiler};
|
||||
use rustc_interface::interface::{Compiler, Config};
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
|
||||
|
|
@ -87,5 +87,5 @@ impl rustc_driver::Callbacks for MyCallbacks {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
RunCompiler::new(&["main.rs".to_string()], &mut MyCallbacks).run();
|
||||
run_compiler(&["main.rs".to_string()], &mut MyCallbacks);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use std::path::Path;
|
|||
|
||||
use rustc_ast_pretty::pprust::item_to_string;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_driver::{Compilation, RunCompiler};
|
||||
use rustc_driver::{Compilation, run_compiler};
|
||||
use rustc_interface::interface::{Compiler, Config};
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
|
||||
|
|
@ -94,5 +94,5 @@ impl rustc_driver::Callbacks for MyCallbacks {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
RunCompiler::new(&["main.rs".to_string()], &mut MyCallbacks).run();
|
||||
run_compiler(&["main.rs".to_string()], &mut MyCallbacks);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ The [`rustc_driver`] is essentially `rustc`'s `main` function.
|
|||
It acts as the glue for running the various phases of the compiler in the correct order,
|
||||
using the interface defined in the [`rustc_interface`] crate. Where possible, using [`rustc_driver`] rather than [`rustc_interface`] is recommended.
|
||||
|
||||
The main entry point of [`rustc_driver`] is [`rustc_driver::RunCompiler`][rd_rc].
|
||||
The main entry point of [`rustc_driver`] is [`rustc_driver::run_compiler`][rd_rc].
|
||||
This builder accepts the same command-line args as rustc as well as an implementation of [`Callbacks`][cb] and a couple of other optional options.
|
||||
[`Callbacks`][cb] is a `trait` that allows for custom compiler configuration,
|
||||
as well as allowing custom code to run after different phases of the compilation.
|
||||
|
|
@ -40,7 +40,7 @@ specifically [`rustc_driver_impl::run_compiler`][rdi_rc]
|
|||
[cb]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/trait.Callbacks.html
|
||||
[example]: https://github.com/rust-lang/rustc-dev-guide/blob/master/examples/rustc-interface-example.rs
|
||||
[i_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/interface/fn.run_compiler.html
|
||||
[rd_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/struct.RunCompiler.html
|
||||
[rd_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/fn.run_compiler.html
|
||||
[rdi_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver_impl/fn.run_compiler.html
|
||||
[stupid-stats]: https://github.com/nrc/stupid-stats
|
||||
[`nightly-rustc`]: https://doc.rust-lang.org/nightly/nightly-rustc/
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ pub fn main() {
|
|||
let mut args: Vec<String> = orig_args.clone();
|
||||
pass_sysroot_env_if_given(&mut args, sys_root_env);
|
||||
|
||||
rustc_driver::RunCompiler::new(&args, &mut DefaultCallbacks).run();
|
||||
rustc_driver::run_compiler(&args, &mut DefaultCallbacks);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
|
@ -295,9 +295,9 @@ pub fn main() {
|
|||
let clippy_enabled = !cap_lints_allow && relevant_package && !info_query;
|
||||
if clippy_enabled {
|
||||
args.extend(clippy_args);
|
||||
rustc_driver::RunCompiler::new(&args, &mut ClippyCallbacks { clippy_args_var }).run();
|
||||
rustc_driver::run_compiler(&args, &mut ClippyCallbacks { clippy_args_var });
|
||||
} else {
|
||||
rustc_driver::RunCompiler::new(&args, &mut RustcCallbacks { clippy_args_var }).run();
|
||||
rustc_driver::run_compiler(&args, &mut RustcCallbacks { clippy_args_var });
|
||||
}
|
||||
Ok(())
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ fn run_compiler_and_exit(
|
|||
) -> ! {
|
||||
// Invoke compiler, and handle return code.
|
||||
let exit_code = rustc_driver::catch_with_exit_code(move || {
|
||||
rustc_driver::RunCompiler::new(args, callbacks).run();
|
||||
rustc_driver::run_compiler(args, callbacks);
|
||||
Ok(())
|
||||
});
|
||||
std::process::exit(exit_code)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue