@@ -262,7 +262,7 @@ where
262
262
/// // Your code goes in here.
263
263
/// # ControlFlow::Continue(())
264
264
/// }
265
- /// # let args = vec! ["--verbose".to_string()];
265
+ /// # let args = & ["--verbose".to_string()];
266
266
/// let result = run!(args, analyze_code);
267
267
/// # assert_eq!(result, Err(CompilerError::Skipped))
268
268
/// # }
@@ -284,7 +284,7 @@ where
284
284
/// // Your code goes in here.
285
285
/// # ControlFlow::Continue(())
286
286
/// }
287
- /// # let args = vec! ["--verbose".to_string()];
287
+ /// # let args = & ["--verbose".to_string()];
288
288
/// # let extra_args = vec![];
289
289
/// let result = run!(args, || analyze_code(extra_args));
290
290
/// # assert_eq!(result, Err(CompilerError::Skipped))
@@ -346,7 +346,6 @@ macro_rules! run_driver {
346
346
C : Send ,
347
347
F : FnOnce ( $( optional!( $with_tcx TyCtxt ) ) ?) -> ControlFlow <B , C > + Send ,
348
348
{
349
- args: Vec <String >,
350
349
callback: Option <F >,
351
350
result: Option <ControlFlow <B , C >>,
352
351
}
@@ -358,14 +357,14 @@ macro_rules! run_driver {
358
357
F : FnOnce ( $( optional!( $with_tcx TyCtxt ) ) ?) -> ControlFlow <B , C > + Send ,
359
358
{
360
359
/// Creates a new `StableMir` instance, with given test_function and arguments.
361
- pub fn new( args : Vec < String > , callback: F ) -> Self {
362
- StableMir { args , callback: Some ( callback) , result: None }
360
+ pub fn new( callback: F ) -> Self {
361
+ StableMir { callback: Some ( callback) , result: None }
363
362
}
364
363
365
364
/// Runs the compiler against given target and tests it with `test_function`
366
- pub fn run( & mut self ) -> Result <C , CompilerError <B >> {
365
+ pub fn run( & mut self , args : & [ String ] ) -> Result <C , CompilerError <B >> {
367
366
let compiler_result = rustc_driver:: catch_fatal_errors( || -> interface:: Result :: <( ) > {
368
- run_compiler( & self . args. clone ( ) , self ) ;
367
+ run_compiler( & args, self ) ;
369
368
Ok ( ( ) )
370
369
} ) ;
371
370
match ( compiler_result, self . result. take( ) ) {
@@ -415,7 +414,7 @@ macro_rules! run_driver {
415
414
}
416
415
}
417
416
418
- StableMir :: new( $args , $ callback) . run( )
417
+ StableMir :: new( $callback) . run( $args )
419
418
} } ;
420
419
}
421
420
0 commit comments