66
77mod sanity_checks;
88
9+ extern crate rustc_driver;
10+ extern crate rustc_interface;
911extern crate rustc_middle;
1012extern crate rustc_smir;
1113extern crate stable_mir;
1214
1315use rustc_middle:: ty:: TyCtxt ;
14- use rustc_smir:: rustc_internal;
16+ use rustc_smir:: { run , rustc_internal} ;
1517use stable_mir:: CompilerError ;
1618use std:: ops:: ControlFlow ;
1719use std:: panic:: { catch_unwind, AssertUnwindSafe } ;
@@ -39,7 +41,7 @@ type TestResult = Result<(), String>;
3941fn main ( ) -> ExitCode {
4042 let args = std:: env:: args ( ) ;
4143 let ( smir_args, rustc_args) : ( Vec < String > , _ ) = args. partition ( |arg| arg. starts_with ( "--smir" ) ) ;
42- let callback = if smir_args. contains ( & CHECK_ARG . to_string ( ) ) {
44+ let result = if smir_args. contains ( & CHECK_ARG . to_string ( ) ) {
4345 VERBOSE . store (
4446 smir_args. contains ( & VERBOSE_ARG . to_string ( ) ) ,
4547 Ordering :: Relaxed ,
@@ -48,11 +50,10 @@ fn main() -> ExitCode {
4850 smir_args. contains ( & FIXME_ARG . to_string ( ) ) ,
4951 Ordering :: Relaxed ,
5052 ) ;
51- test_stable_mir
53+ run ! ( rustc_args , tcx , test_stable_mir( tcx ) )
5254 } else {
53- |_ : TyCtxt | ControlFlow :: < ( ) > :: Continue ( ( ) )
55+ run ! ( rustc_args , ControlFlow :: <( ) >:: Continue ( ( ) ) )
5456 } ;
55- let result = rustc_internal:: StableMir :: new ( rustc_args, callback) . run ( ) ;
5657 if result. is_ok ( ) || matches ! ( result, Err ( CompilerError :: Skipped ) ) {
5758 ExitCode :: SUCCESS
5859 } else {
0 commit comments