6
6
7
7
mod sanity_checks;
8
8
9
+ extern crate rustc_driver;
10
+ extern crate rustc_interface;
9
11
extern crate rustc_middle;
10
12
extern crate rustc_smir;
11
13
extern crate stable_mir;
12
14
13
15
use rustc_middle:: ty:: TyCtxt ;
14
- use rustc_smir:: rustc_internal;
16
+ use rustc_smir:: { run , rustc_internal} ;
15
17
use stable_mir:: CompilerError ;
16
18
use std:: ops:: ControlFlow ;
17
19
use std:: panic:: { catch_unwind, AssertUnwindSafe } ;
@@ -39,7 +41,7 @@ type TestResult = Result<(), String>;
39
41
fn main ( ) -> ExitCode {
40
42
let args = std:: env:: args ( ) ;
41
43
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 ( ) ) {
43
45
VERBOSE . store (
44
46
smir_args. contains ( & VERBOSE_ARG . to_string ( ) ) ,
45
47
Ordering :: Relaxed ,
@@ -48,11 +50,10 @@ fn main() -> ExitCode {
48
50
smir_args. contains ( & FIXME_ARG . to_string ( ) ) ,
49
51
Ordering :: Relaxed ,
50
52
) ;
51
- test_stable_mir
53
+ run ! ( rustc_args , tcx , test_stable_mir( tcx ) )
52
54
} else {
53
- |_ : TyCtxt | ControlFlow :: < ( ) > :: Continue ( ( ) )
55
+ run ! ( rustc_args , ControlFlow :: <( ) >:: Continue ( ( ) ) )
54
56
} ;
55
- let result = rustc_internal:: StableMir :: new ( rustc_args, callback) . run ( ) ;
56
57
if result. is_ok ( ) || matches ! ( result, Err ( CompilerError :: Skipped ) ) {
57
58
ExitCode :: SUCCESS
58
59
} else {
0 commit comments