@@ -256,7 +256,7 @@ where
256256/// // Your code goes in here.
257257/// # ControlFlow::Continue(())
258258/// }
259- /// # let args = vec! ["--verbose".to_string()];
259+ /// # let args = & ["--verbose".to_string()];
260260/// let result = run!(args, analyze_code);
261261/// # assert_eq!(result, Err(CompilerError::Skipped))
262262/// # }
@@ -278,7 +278,7 @@ where
278278/// // Your code goes in here.
279279/// # ControlFlow::Continue(())
280280/// }
281- /// # let args = vec! ["--verbose".to_string()];
281+ /// # let args = & ["--verbose".to_string()];
282282/// # let extra_args = vec![];
283283/// let result = run!(args, || analyze_code(extra_args));
284284/// # assert_eq!(result, Err(CompilerError::Skipped))
@@ -340,7 +340,6 @@ macro_rules! run_driver {
340340 C : Send ,
341341 F : FnOnce ( $( optional!( $with_tcx TyCtxt ) ) ?) -> ControlFlow <B , C > + Send ,
342342 {
343- args: Vec <String >,
344343 callback: Option <F >,
345344 result: Option <ControlFlow <B , C >>,
346345 }
@@ -352,14 +351,14 @@ macro_rules! run_driver {
352351 F : FnOnce ( $( optional!( $with_tcx TyCtxt ) ) ?) -> ControlFlow <B , C > + Send ,
353352 {
354353 /// 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 }
357356 }
358357
359358 /// 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 >> {
361360 let compiler_result = rustc_driver:: catch_fatal_errors( || -> interface:: Result :: <( ) > {
362- run_compiler( & self . args. clone ( ) , self ) ;
361+ run_compiler( & args, self ) ;
363362 Ok ( ( ) )
364363 } ) ;
365364 match ( compiler_result, self . result. take( ) ) {
@@ -409,7 +408,7 @@ macro_rules! run_driver {
409408 }
410409 }
411410
412- StableMir :: new( $args , $ callback) . run( )
411+ StableMir :: new( $callback) . run( $args )
413412 } } ;
414413}
415414
0 commit comments