@@ -262,7 +262,7 @@ where
262262/// // Your code goes in here.
263263/// # ControlFlow::Continue(())
264264/// }
265- /// # let args = vec! ["--verbose".to_string()];
265+ /// # let args = & ["--verbose".to_string()];
266266/// let result = run!(args, analyze_code);
267267/// # assert_eq!(result, Err(CompilerError::Skipped))
268268/// # }
@@ -284,7 +284,7 @@ where
284284/// // Your code goes in here.
285285/// # ControlFlow::Continue(())
286286/// }
287- /// # let args = vec! ["--verbose".to_string()];
287+ /// # let args = & ["--verbose".to_string()];
288288/// # let extra_args = vec![];
289289/// let result = run!(args, || analyze_code(extra_args));
290290/// # assert_eq!(result, Err(CompilerError::Skipped))
@@ -346,7 +346,6 @@ macro_rules! run_driver {
346346 C : Send ,
347347 F : FnOnce ( $( optional!( $with_tcx TyCtxt ) ) ?) -> ControlFlow <B , C > + Send ,
348348 {
349- args: Vec <String >,
350349 callback: Option <F >,
351350 result: Option <ControlFlow <B , C >>,
352351 }
@@ -358,14 +357,14 @@ macro_rules! run_driver {
358357 F : FnOnce ( $( optional!( $with_tcx TyCtxt ) ) ?) -> ControlFlow <B , C > + Send ,
359358 {
360359 /// 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 }
363362 }
364363
365364 /// 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 >> {
367366 let compiler_result = rustc_driver:: catch_fatal_errors( || -> interface:: Result :: <( ) > {
368- run_compiler( & self . args. clone ( ) , self ) ;
367+ run_compiler( & args, self ) ;
369368 Ok ( ( ) )
370369 } ) ;
371370 match ( compiler_result, self . result. take( ) ) {
@@ -415,7 +414,7 @@ macro_rules! run_driver {
415414 }
416415 }
417416
418- StableMir :: new( $args , $ callback) . run( )
417+ StableMir :: new( $callback) . run( $args )
419418 } } ;
420419}
421420
0 commit comments