File tree Expand file tree Collapse file tree 9 files changed +16
-32
lines changed
rustc_smir/src/rustc_internal Expand file tree Collapse file tree 9 files changed +16
-32
lines changed Original file line number Diff line number Diff line change @@ -207,23 +207,7 @@ pub fn diagnostics_registry() -> Registry {
207207}
208208
209209/// This is the primary entry point for rustc.
210- pub struct RunCompiler <' a> {
211- at_args: & ' a [ String ] ,
212- callbacks: & ' a mut ( dyn Callbacks + Send ) ,
213- }
214-
215- impl <' a> RunCompiler <' a> {
216- pub fn new( at_args: & ' a [ String ] , callbacks: & ' a mut ( dyn Callbacks + Send ) ) -> Self {
217- Self { at_args, callbacks }
218- }
219-
220- /// Parse args and run the compiler.
221- pub fn run( self ) {
222- run_compiler( self . at_args, self . callbacks) ;
223- }
224- }
225-
226- fn run_compiler( at_args: & [ String ] , callbacks: & mut ( dyn Callbacks + Send ) ) {
210+ pub fn run_compiler( at_args: & [ String ] , callbacks: & mut ( dyn Callbacks + Send ) ) {
227211 let mut default_early_dcx = EarlyDiagCtxt :: new( ErrorOutputType :: default ( ) ) ;
228212
229213 // Throw away the first argument, the name of the binary.
@@ -1516,7 +1500,7 @@ pub fn main() -> ! {
15161500 install_ctrlc_handler( ) ;
15171501
15181502 let exit_code = catch_with_exit_code( || {
1519- RunCompiler :: new ( & args:: raw_args( & early_dcx) ?, & mut callbacks) . run ( ) ;
1503+ run_compiler ( & args:: raw_args( & early_dcx) ?, & mut callbacks) ;
15201504 Ok ( ( ) )
15211505 } ) ;
15221506
Original file line number Diff line number Diff line change @@ -316,7 +316,7 @@ macro_rules! optional {
316316#[ doc( hidden) ]
317317macro_rules! run_driver {
318318 ( $args: expr, $callback: expr $( , $with_tcx: ident) ?) => { {
319- use rustc_driver:: { Callbacks , Compilation , RunCompiler } ;
319+ use rustc_driver:: { Callbacks , Compilation , run_compiler } ;
320320 use rustc_middle:: ty:: TyCtxt ;
321321 use rustc_interface:: interface;
322322 use stable_mir:: CompilerError ;
@@ -347,7 +347,7 @@ macro_rules! run_driver {
347347 /// Runs the compiler against given target and tests it with `test_function`
348348 pub fn run( & mut self ) -> Result <C , CompilerError <B >> {
349349 let compiler_result = rustc_driver:: catch_fatal_errors( || -> interface:: Result :: <( ) > {
350- RunCompiler :: new ( & self . args. clone( ) , self ) . run ( ) ;
350+ run_compiler ( & self . args. clone( ) , self ) ;
351351 Ok ( ( ) )
352352 } ) ;
353353 match ( compiler_result, self . result. take( ) ) {
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ use std::path::Path;
1818
1919use rustc_ast_pretty:: pprust:: item_to_string;
2020use rustc_data_structures:: sync:: Lrc ;
21- use rustc_driver:: { Compilation , RunCompiler } ;
21+ use rustc_driver:: { Compilation , run_compiler } ;
2222use rustc_interface:: interface:: { Compiler , Config } ;
2323use rustc_middle:: ty:: TyCtxt ;
2424
@@ -87,5 +87,5 @@ impl rustc_driver::Callbacks for MyCallbacks {
8787}
8888
8989fn main ( ) {
90- RunCompiler :: new ( & [ "main.rs" . to_string ( ) ] , & mut MyCallbacks ) . run ( ) ;
90+ run_compiler ( & [ "main.rs" . to_string ( ) ] , & mut MyCallbacks ) ;
9191}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ use std::path::Path;
1818
1919use rustc_ast_pretty:: pprust:: item_to_string;
2020use rustc_data_structures:: sync:: Lrc ;
21- use rustc_driver:: { Compilation , RunCompiler } ;
21+ use rustc_driver:: { Compilation , run_compiler } ;
2222use rustc_interface:: interface:: { Compiler , Config } ;
2323use rustc_middle:: ty:: TyCtxt ;
2424
@@ -94,5 +94,5 @@ impl rustc_driver::Callbacks for MyCallbacks {
9494}
9595
9696fn main ( ) {
97- RunCompiler :: new ( & [ "main.rs" . to_string ( ) ] , & mut MyCallbacks ) . run ( ) ;
97+ run_compiler ( & [ "main.rs" . to_string ( ) ] , & mut MyCallbacks ) ;
9898}
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ The [`rustc_driver`] is essentially `rustc`'s `main` function.
66It acts as the glue for running the various phases of the compiler in the correct order,
77using the interface defined in the [ ` rustc_interface ` ] crate. Where possible, using [ ` rustc_driver ` ] rather than [ ` rustc_interface ` ] is recommended.
88
9- The main entry point of [ ` rustc_driver ` ] is [ ` rustc_driver::RunCompiler ` ] [ rd_rc ] .
9+ The main entry point of [ ` rustc_driver ` ] is [ ` rustc_driver::run_compiler ` ] [ rd_rc ] .
1010This builder accepts the same command-line args as rustc as well as an implementation of [ ` Callbacks ` ] [ cb ] and a couple of other optional options.
1111[ ` Callbacks ` ] [ cb ] is a ` trait ` that allows for custom compiler configuration,
1212as 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]
4040[ cb ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/trait.Callbacks.html
4141[ example ] : https://github.com/rust-lang/rustc-dev-guide/blob/master/examples/rustc-interface-example.rs
4242[ i_rc ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/interface/fn.run_compiler.html
43- [ rd_rc ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/struct.RunCompiler .html
43+ [ rd_rc ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/fn.run_compiler .html
4444[ rdi_rc ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver_impl/fn.run_compiler.html
4545[ stupid-stats ] : https://github.com/nrc/stupid-stats
4646[ `nightly-rustc` ] : https://doc.rust-lang.org/nightly/nightly-rustc/
Original file line number Diff line number Diff line change @@ -236,7 +236,7 @@ pub fn main() {
236236 let mut args: Vec < String > = orig_args. clone ( ) ;
237237 pass_sysroot_env_if_given ( & mut args, sys_root_env) ;
238238
239- rustc_driver:: RunCompiler :: new ( & args, & mut DefaultCallbacks ) . run ( ) ;
239+ rustc_driver:: run_compiler ( & args, & mut DefaultCallbacks ) ;
240240 return Ok ( ( ) ) ;
241241 }
242242
@@ -295,9 +295,9 @@ pub fn main() {
295295 let clippy_enabled = !cap_lints_allow && relevant_package && !info_query;
296296 if clippy_enabled {
297297 args. extend ( clippy_args) ;
298- rustc_driver:: RunCompiler :: new ( & args, & mut ClippyCallbacks { clippy_args_var } ) . run ( ) ;
298+ rustc_driver:: run_compiler ( & args, & mut ClippyCallbacks { clippy_args_var } ) ;
299299 } else {
300- rustc_driver:: RunCompiler :: new ( & args, & mut RustcCallbacks { clippy_args_var } ) . run ( ) ;
300+ rustc_driver:: run_compiler ( & args, & mut RustcCallbacks { clippy_args_var } ) ;
301301 }
302302 Ok ( ( ) )
303303 } ) )
Original file line number Diff line number Diff line change @@ -373,7 +373,7 @@ fn run_compiler_and_exit(
373373) -> ! {
374374 // Invoke compiler, and handle return code.
375375 let exit_code = rustc_driver:: catch_with_exit_code ( move || {
376- rustc_driver:: RunCompiler :: new ( args, callbacks) . run ( ) ;
376+ rustc_driver:: run_compiler ( args, callbacks) ;
377377 Ok ( ( ) )
378378 } ) ;
379379 std:: process:: exit ( exit_code)
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ fn main() {
2525 let mut count = 1 ;
2626 let args = vec ! [ "compiler-calls" . to_string( ) , "foo.rs" . to_string( ) ] ;
2727 rustc_driver:: catch_fatal_errors ( || -> interface:: Result < ( ) > {
28- rustc_driver:: RunCompiler :: new ( & args, & mut TestCalls { count : & mut count } ) . run ( ) ;
28+ rustc_driver:: run_compiler ( & args, & mut TestCalls { count : & mut count } ) ;
2929 Ok ( ( ) )
3030 } )
3131 . ok ( ) ;
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ fn main() {
4747 rustc_args. push ( "-Zpolonius" . to_owned ( ) ) ;
4848 let mut callbacks = CompilerCalls :: default ( ) ;
4949 // Call the Rust compiler with our callbacks.
50- rustc_driver:: RunCompiler :: new ( & rustc_args, & mut callbacks) . run ( ) ;
50+ rustc_driver:: run_compiler ( & rustc_args, & mut callbacks) ;
5151 Ok ( ( ) )
5252 } ) ;
5353 std:: process:: exit ( exit_code) ;
You can’t perform that action at this time.
0 commit comments