@@ -256,7 +256,7 @@ where
256
256
/// // Your code goes in here.
257
257
/// # ControlFlow::Continue(())
258
258
/// }
259
- /// # let args = vec! ["--verbose".to_string()];
259
+ /// # let args = & ["--verbose".to_string()];
260
260
/// let result = run!(args, analyze_code);
261
261
/// # assert_eq!(result, Err(CompilerError::Skipped))
262
262
/// # }
@@ -278,7 +278,7 @@ where
278
278
/// // Your code goes in here.
279
279
/// # ControlFlow::Continue(())
280
280
/// }
281
- /// # let args = vec! ["--verbose".to_string()];
281
+ /// # let args = & ["--verbose".to_string()];
282
282
/// # let extra_args = vec![];
283
283
/// let result = run!(args, || analyze_code(extra_args));
284
284
/// # assert_eq!(result, Err(CompilerError::Skipped))
@@ -340,7 +340,6 @@ macro_rules! run_driver {
340
340
C : Send ,
341
341
F : FnOnce ( $( optional!( $with_tcx TyCtxt ) ) ?) -> ControlFlow <B , C > + Send ,
342
342
{
343
- args: Vec <String >,
344
343
callback: Option <F >,
345
344
result: Option <ControlFlow <B , C >>,
346
345
}
@@ -352,14 +351,14 @@ macro_rules! run_driver {
352
351
F : FnOnce ( $( optional!( $with_tcx TyCtxt ) ) ?) -> ControlFlow <B , C > + Send ,
353
352
{
354
353
/// Creates a new `StableMir` instance, with given test_function and arguments.
355
- pub fn new( args : Vec < String > , callback: F ) -> Self {
356
- StableMir { args , callback: Some ( callback) , result: None }
354
+ pub fn new( callback: F ) -> Self {
355
+ StableMir { callback: Some ( callback) , result: None }
357
356
}
358
357
359
358
/// Runs the compiler against given target and tests it with `test_function`
360
- pub fn run( & mut self ) -> Result <C , CompilerError <B >> {
359
+ pub fn run( & mut self , args : & [ String ] ) -> Result <C , CompilerError <B >> {
361
360
let compiler_result = rustc_driver:: catch_fatal_errors( || -> interface:: Result :: <( ) > {
362
- run_compiler( & self . args. clone ( ) , self ) ;
361
+ run_compiler( & args, self ) ;
363
362
Ok ( ( ) )
364
363
} ) ;
365
364
match ( compiler_result, self . result. take( ) ) {
@@ -409,7 +408,7 @@ macro_rules! run_driver {
409
408
}
410
409
}
411
410
412
- StableMir :: new( $args , $ callback) . run( )
411
+ StableMir :: new( $callback) . run( $args )
413
412
} } ;
414
413
}
415
414
0 commit comments