From 055a27da2afcc8a7d74a551c32e8a831a825d549 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 24 Apr 2025 08:49:49 +1000 Subject: [PATCH 1/2] Remove some unnecessary clones. I found these by grepping for `&[a-z_\.]*\.clone()`, i.e. expressions like `&a.b.clone()`, which are sometimes unnecessary clones, and also looking at clones nearby to cases like that. --- compiler/rustc_ast_pretty/src/pprust/state.rs | 4 ++-- .../src/traits/query/type_op/ascribe_user_type.rs | 3 +-- library/alloc/src/collections/btree/set.rs | 2 +- src/bootstrap/src/core/build_steps/setup.rs | 6 +++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index 0985ebf945bbd..194ae9041b1a0 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -799,7 +799,7 @@ pub trait PrintState<'a>: std::ops::Deref + std::ops::Dere has_bang, Some(*ident), macro_def.body.delim, - ¯o_def.body.tokens.clone(), + ¯o_def.body.tokens, true, sp, ); @@ -1469,7 +1469,7 @@ impl<'a> State<'a> { true, None, m.args.delim, - &m.args.tokens.clone(), + &m.args.tokens, true, m.span(), ); diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs index 4eecde00eaa1e..f059bd0076897 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs @@ -117,8 +117,7 @@ fn relate_mir_and_user_args<'tcx>( CRATE_DEF_ID, ObligationCauseCode::AscribeUserTypeProvePredicate(predicate_span), ); - let instantiated_predicate = - ocx.normalize(&cause.clone(), param_env, instantiated_predicate); + let instantiated_predicate = ocx.normalize(&cause, param_env, instantiated_predicate); ocx.register_obligation(Obligation::new(tcx, cause, param_env, instantiated_predicate)); } diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs index 041f80c1f2c52..7ad9e59dfede1 100644 --- a/library/alloc/src/collections/btree/set.rs +++ b/library/alloc/src/collections/btree/set.rs @@ -139,7 +139,7 @@ pub struct Iter<'a, T: 'a> { #[stable(feature = "collection_debug", since = "1.17.0")] impl fmt::Debug for Iter<'_, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_tuple("Iter").field(&self.iter.clone()).finish() + f.debug_tuple("Iter").field(&self.iter).finish() } } diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs index 83083e12ef1fc..9d07babe5196b 100644 --- a/src/bootstrap/src/core/build_steps/setup.rs +++ b/src/bootstrap/src/core/build_steps/setup.rs @@ -683,7 +683,7 @@ impl Step for Editor { match EditorKind::prompt_user() { Ok(editor_kind) => { if let Some(editor_kind) = editor_kind { - while !t!(create_editor_settings_maybe(config, editor_kind.clone())) {} + while !t!(create_editor_settings_maybe(config, &editor_kind)) {} } else { println!("Ok, skipping editor setup!"); } @@ -695,7 +695,7 @@ impl Step for Editor { /// Create the recommended editor LSP config file for rustc development, or just print it /// If this method should be re-called, it returns `false`. -fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Result { +fn create_editor_settings_maybe(config: &Config, editor: &EditorKind) -> io::Result { let hashes = editor.hashes(); let (current_hash, historical_hashes) = hashes.split_last().unwrap(); let settings_path = editor.settings_path(config); @@ -752,7 +752,7 @@ fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Resu // exists but user modified, back it up Some(false) => { // exists and is not current version or outdated, so back it up - let backup = settings_path.clone().with_extension(editor.backup_extension()); + let backup = settings_path.with_extension(editor.backup_extension()); eprintln!( "WARNING: copying `{}` to `{}`", settings_path.file_name().unwrap().to_str().unwrap(), From af8047789dded51803be6cba1a708cddb1618020 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 24 Apr 2025 08:50:11 +1000 Subject: [PATCH 2/2] Refactor `StableMir` to avoid some clones. Pass `args` to `run` instead of storing it in a field. This avoids the need to clone it within `run`. Also, change `args` from `Vec` to `&[String]`, avoiding the need for some vecs and clones. --- compiler/rustc_smir/src/rustc_internal/mod.rs | 15 +++++------ tests/ui-fulldeps/stable-mir/check_abi.rs | 2 +- .../stable-mir/check_allocation.rs | 2 +- .../stable-mir/check_assoc_items.rs | 2 +- .../ui-fulldeps/stable-mir/check_attribute.rs | 2 +- tests/ui-fulldeps/stable-mir/check_binop.rs | 2 +- .../stable-mir/check_crate_defs.rs | 2 +- tests/ui-fulldeps/stable-mir/check_def_ty.rs | 2 +- tests/ui-fulldeps/stable-mir/check_defs.rs | 2 +- tests/ui-fulldeps/stable-mir/check_foreign.rs | 2 +- .../ui-fulldeps/stable-mir/check_instance.rs | 2 +- .../stable-mir/check_intrinsics.rs | 2 +- .../ui-fulldeps/stable-mir/check_item_kind.rs | 2 +- .../stable-mir/check_normalization.rs | 2 +- .../stable-mir/check_trait_queries.rs | 2 +- .../ui-fulldeps/stable-mir/check_transform.rs | 2 +- tests/ui-fulldeps/stable-mir/check_ty_fold.rs | 2 +- .../stable-mir/compilation-result.rs | 26 ++++++++++--------- tests/ui-fulldeps/stable-mir/crate-info.rs | 2 +- tests/ui-fulldeps/stable-mir/projections.rs | 2 +- tests/ui-fulldeps/stable-mir/smir_internal.rs | 2 +- tests/ui-fulldeps/stable-mir/smir_serde.rs | 2 +- tests/ui-fulldeps/stable-mir/smir_visitor.rs | 4 +-- 23 files changed, 43 insertions(+), 42 deletions(-) diff --git a/compiler/rustc_smir/src/rustc_internal/mod.rs b/compiler/rustc_smir/src/rustc_internal/mod.rs index 146ba17d14fc8..8a7c1bd89fab6 100644 --- a/compiler/rustc_smir/src/rustc_internal/mod.rs +++ b/compiler/rustc_smir/src/rustc_internal/mod.rs @@ -256,7 +256,7 @@ where /// // Your code goes in here. /// # ControlFlow::Continue(()) /// } -/// # let args = vec!["--verbose".to_string()]; +/// # let args = &["--verbose".to_string()]; /// let result = run!(args, analyze_code); /// # assert_eq!(result, Err(CompilerError::Skipped)) /// # } @@ -278,7 +278,7 @@ where /// // Your code goes in here. /// # ControlFlow::Continue(()) /// } -/// # let args = vec!["--verbose".to_string()]; +/// # let args = &["--verbose".to_string()]; /// # let extra_args = vec![]; /// let result = run!(args, || analyze_code(extra_args)); /// # assert_eq!(result, Err(CompilerError::Skipped)) @@ -340,7 +340,6 @@ macro_rules! run_driver { C: Send, F: FnOnce($(optional!($with_tcx TyCtxt))?) -> ControlFlow + Send, { - args: Vec, callback: Option, result: Option>, } @@ -352,14 +351,14 @@ macro_rules! run_driver { F: FnOnce($(optional!($with_tcx TyCtxt))?) -> ControlFlow + Send, { /// Creates a new `StableMir` instance, with given test_function and arguments. - pub fn new(args: Vec, callback: F) -> Self { - StableMir { args, callback: Some(callback), result: None } + pub fn new(callback: F) -> Self { + StableMir { callback: Some(callback), result: None } } /// Runs the compiler against given target and tests it with `test_function` - pub fn run(&mut self) -> Result> { + pub fn run(&mut self, args: &[String]) -> Result> { let compiler_result = rustc_driver::catch_fatal_errors(|| -> interface::Result::<()> { - run_compiler(&self.args.clone(), self); + run_compiler(&args, self); Ok(()) }); match (compiler_result, self.result.take()) { @@ -409,7 +408,7 @@ macro_rules! run_driver { } } - StableMir::new($args, $callback).run() + StableMir::new($callback).run($args) }}; } diff --git a/tests/ui-fulldeps/stable-mir/check_abi.rs b/tests/ui-fulldeps/stable-mir/check_abi.rs index ebf2e333f085a..71edf813a7be2 100644 --- a/tests/ui-fulldeps/stable-mir/check_abi.rs +++ b/tests/ui-fulldeps/stable-mir/check_abi.rs @@ -145,7 +145,7 @@ fn get_item<'a>( fn main() { let path = "alloc_input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "--crate-type=lib".to_string(), "--crate-name".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/check_allocation.rs b/tests/ui-fulldeps/stable-mir/check_allocation.rs index ae2609bbc1221..692c24f054451 100644 --- a/tests/ui-fulldeps/stable-mir/check_allocation.rs +++ b/tests/ui-fulldeps/stable-mir/check_allocation.rs @@ -219,7 +219,7 @@ fn get_item<'a>( fn main() { let path = "alloc_input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "--edition=2021".to_string(), "--crate-name".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/check_assoc_items.rs b/tests/ui-fulldeps/stable-mir/check_assoc_items.rs index 9d611543b5aa7..755bec8747bc8 100644 --- a/tests/ui-fulldeps/stable-mir/check_assoc_items.rs +++ b/tests/ui-fulldeps/stable-mir/check_assoc_items.rs @@ -85,7 +85,7 @@ fn check_items(items: &[T], expected: &[&str]) { fn main() { let path = "assoc_items.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "--crate-type=lib".to_string(), "--crate-name".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/check_attribute.rs b/tests/ui-fulldeps/stable-mir/check_attribute.rs index 4148fc0cb6a07..81d5399d88aa6 100644 --- a/tests/ui-fulldeps/stable-mir/check_attribute.rs +++ b/tests/ui-fulldeps/stable-mir/check_attribute.rs @@ -57,7 +57,7 @@ fn get_item<'a>( fn main() { let path = "attribute_input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "--crate-type=lib".to_string(), "--crate-name".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/check_binop.rs b/tests/ui-fulldeps/stable-mir/check_binop.rs index 6a141e9c5775c..f9559d9958d28 100644 --- a/tests/ui-fulldeps/stable-mir/check_binop.rs +++ b/tests/ui-fulldeps/stable-mir/check_binop.rs @@ -81,7 +81,7 @@ impl<'a> MirVisitor for Visitor<'a> { fn main() { let path = "binop_input.rs"; generate_input(&path).unwrap(); - let args = vec!["rustc".to_string(), "--crate-type=lib".to_string(), path.to_string()]; + let args = &["rustc".to_string(), "--crate-type=lib".to_string(), path.to_string()]; run!(args, test_binops).unwrap(); } diff --git a/tests/ui-fulldeps/stable-mir/check_crate_defs.rs b/tests/ui-fulldeps/stable-mir/check_crate_defs.rs index 31c47192d090f..6863242f22571 100644 --- a/tests/ui-fulldeps/stable-mir/check_crate_defs.rs +++ b/tests/ui-fulldeps/stable-mir/check_crate_defs.rs @@ -84,7 +84,7 @@ fn contains(items: &[T], expected: &[&str]) { fn main() { let path = "crate_definitions.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "--crate-type=lib".to_string(), "--crate-name".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/check_def_ty.rs b/tests/ui-fulldeps/stable-mir/check_def_ty.rs index 00a34f138673b..f86a8e0ae6189 100644 --- a/tests/ui-fulldeps/stable-mir/check_def_ty.rs +++ b/tests/ui-fulldeps/stable-mir/check_def_ty.rs @@ -76,7 +76,7 @@ fn check_fn_def(ty: Ty) { fn main() { let path = "defs_ty_input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "-Cpanic=abort".to_string(), "--crate-name".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/check_defs.rs b/tests/ui-fulldeps/stable-mir/check_defs.rs index 1ba73377d6e9f..ab741378bb713 100644 --- a/tests/ui-fulldeps/stable-mir/check_defs.rs +++ b/tests/ui-fulldeps/stable-mir/check_defs.rs @@ -112,7 +112,7 @@ fn get_instances(body: mir::Body) -> Vec { fn main() { let path = "defs_input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "-Cpanic=abort".to_string(), "--crate-name".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/check_foreign.rs b/tests/ui-fulldeps/stable-mir/check_foreign.rs index 4419050ceb2c1..398024c4ff082 100644 --- a/tests/ui-fulldeps/stable-mir/check_foreign.rs +++ b/tests/ui-fulldeps/stable-mir/check_foreign.rs @@ -58,7 +58,7 @@ fn test_foreign() -> ControlFlow<()> { fn main() { let path = "foreign_input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "-Cpanic=abort".to_string(), "--crate-type=lib".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/check_instance.rs b/tests/ui-fulldeps/stable-mir/check_instance.rs index 1510a622cdfdb..b19e5b033c469 100644 --- a/tests/ui-fulldeps/stable-mir/check_instance.rs +++ b/tests/ui-fulldeps/stable-mir/check_instance.rs @@ -87,7 +87,7 @@ fn test_body(body: mir::Body) { fn main() { let path = "instance_input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "-Cpanic=abort".to_string(), "--crate-type=lib".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/check_intrinsics.rs b/tests/ui-fulldeps/stable-mir/check_intrinsics.rs index 3f04abbb9d76d..52424857dc196 100644 --- a/tests/ui-fulldeps/stable-mir/check_intrinsics.rs +++ b/tests/ui-fulldeps/stable-mir/check_intrinsics.rs @@ -115,7 +115,7 @@ impl<'a> MirVisitor for CallsVisitor<'a> { fn main() { let path = "binop_input.rs"; generate_input(&path).unwrap(); - let args = vec!["rustc".to_string(), "--crate-type=lib".to_string(), path.to_string()]; + let args = &["rustc".to_string(), "--crate-type=lib".to_string(), path.to_string()]; run!(args, test_intrinsics).unwrap(); } diff --git a/tests/ui-fulldeps/stable-mir/check_item_kind.rs b/tests/ui-fulldeps/stable-mir/check_item_kind.rs index bb8c00c64c955..d1124c75a8997 100644 --- a/tests/ui-fulldeps/stable-mir/check_item_kind.rs +++ b/tests/ui-fulldeps/stable-mir/check_item_kind.rs @@ -47,7 +47,7 @@ fn test_item_kind() -> ControlFlow<()> { fn main() { let path = "item_kind_input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "-Cpanic=abort".to_string(), "--crate-type=lib".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/check_normalization.rs b/tests/ui-fulldeps/stable-mir/check_normalization.rs index 797cb4cd5d051..16e8c0339ed47 100644 --- a/tests/ui-fulldeps/stable-mir/check_normalization.rs +++ b/tests/ui-fulldeps/stable-mir/check_normalization.rs @@ -61,7 +61,7 @@ fn check_ty(ty: Ty) { fn main() { let path = "normalization_input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "-Cpanic=abort".to_string(), "--crate-type=lib".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/check_trait_queries.rs b/tests/ui-fulldeps/stable-mir/check_trait_queries.rs index d9170d0c40811..fcf04a1fc3a3f 100644 --- a/tests/ui-fulldeps/stable-mir/check_trait_queries.rs +++ b/tests/ui-fulldeps/stable-mir/check_trait_queries.rs @@ -72,7 +72,7 @@ fn assert_impl(impl_names: &HashSet, target: &str) { fn main() { let path = "trait_queries.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "--crate-type=lib".to_string(), "--crate-name".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/check_transform.rs b/tests/ui-fulldeps/stable-mir/check_transform.rs index 604cc72c3418e..9087c1cf45027 100644 --- a/tests/ui-fulldeps/stable-mir/check_transform.rs +++ b/tests/ui-fulldeps/stable-mir/check_transform.rs @@ -120,7 +120,7 @@ fn get_item<'a>( fn main() { let path = "transform_input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "--crate-type=lib".to_string(), "--crate-name".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/check_ty_fold.rs b/tests/ui-fulldeps/stable-mir/check_ty_fold.rs index 23233f8406cf5..18b9e32e4e809 100644 --- a/tests/ui-fulldeps/stable-mir/check_ty_fold.rs +++ b/tests/ui-fulldeps/stable-mir/check_ty_fold.rs @@ -78,7 +78,7 @@ impl<'a> MirVisitor for PlaceVisitor<'a> { fn main() { let path = "ty_fold_input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "-Cpanic=abort".to_string(), "--crate-name".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/compilation-result.rs b/tests/ui-fulldeps/stable-mir/compilation-result.rs index 39416636fd673..19b9c8b7de508 100644 --- a/tests/ui-fulldeps/stable-mir/compilation-result.rs +++ b/tests/ui-fulldeps/stable-mir/compilation-result.rs @@ -25,40 +25,42 @@ use std::io::Write; fn main() { let path = "input_compilation_result_test.rs"; generate_input(&path).unwrap(); - let args = vec!["rustc".to_string(), path.to_string()]; - test_continue(args.clone()); - test_break(args.clone()); - test_failed(args.clone()); - test_skipped(args.clone()); + let args = &["rustc".to_string(), path.to_string()]; + test_continue(args); + test_break(args); + test_failed(args); + test_skipped(args); test_captured(args) } -fn test_continue(args: Vec) { +fn test_continue(args: &[String]) { let result = run!(args, || ControlFlow::Continue::<(), bool>(true)); assert_eq!(result, Ok(true)); } -fn test_break(args: Vec) { +fn test_break(args: &[String]) { let result = run!(args, || ControlFlow::Break::(false)); assert_eq!(result, Err(stable_mir::CompilerError::Interrupted(false))); } #[allow(unreachable_code)] -fn test_skipped(mut args: Vec) { +fn test_skipped(args: &[String]) { + let mut args = args.to_vec(); args.push("--version".to_string()); - let result = run!(args, || unreachable!() as ControlFlow<()>); + let result = run!(&args, || unreachable!() as ControlFlow<()>); assert_eq!(result, Err(stable_mir::CompilerError::Skipped)); } #[allow(unreachable_code)] -fn test_failed(mut args: Vec) { +fn test_failed(args: &[String]) { + let mut args = args.to_vec(); args.push("--cfg=broken".to_string()); - let result = run!(args, || unreachable!() as ControlFlow<()>); + let result = run!(&args, || unreachable!() as ControlFlow<()>); assert_eq!(result, Err(stable_mir::CompilerError::Failed)); } /// Test that we are able to pass a closure and set the return according to the captured value. -fn test_captured(args: Vec) { +fn test_captured(args: &[String]) { let captured = "10".to_string(); let result = run!(args, || ControlFlow::Continue::<(), usize>(captured.len())); assert_eq!(result, Ok(captured.len())); diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs index e2086d5e57907..7fc4edafb9338 100644 --- a/tests/ui-fulldeps/stable-mir/crate-info.rs +++ b/tests/ui-fulldeps/stable-mir/crate-info.rs @@ -186,7 +186,7 @@ fn get_item<'a>( fn main() { let path = "input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "--crate-type=lib".to_string(), "--crate-name".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/projections.rs b/tests/ui-fulldeps/stable-mir/projections.rs index f3bd894ac6903..103c97bc48e17 100644 --- a/tests/ui-fulldeps/stable-mir/projections.rs +++ b/tests/ui-fulldeps/stable-mir/projections.rs @@ -146,7 +146,7 @@ fn get_item<'a>( fn main() { let path = "input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "--crate-type=lib".to_string(), "--crate-name".to_string(), diff --git a/tests/ui-fulldeps/stable-mir/smir_internal.rs b/tests/ui-fulldeps/stable-mir/smir_internal.rs index f9972dc27e3ff..0519b9de68050 100644 --- a/tests/ui-fulldeps/stable-mir/smir_internal.rs +++ b/tests/ui-fulldeps/stable-mir/smir_internal.rs @@ -40,7 +40,7 @@ fn test_translation(tcx: TyCtxt<'_>) -> ControlFlow<()> { fn main() { let path = "internal_input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "--crate-name".to_string(), CRATE_NAME.to_string(), diff --git a/tests/ui-fulldeps/stable-mir/smir_serde.rs b/tests/ui-fulldeps/stable-mir/smir_serde.rs index 3b3d743ad3263..0b39ec050024e 100644 --- a/tests/ui-fulldeps/stable-mir/smir_serde.rs +++ b/tests/ui-fulldeps/stable-mir/smir_serde.rs @@ -46,7 +46,7 @@ fn serialize_to_json(_tcx: TyCtxt<'_>) -> ControlFlow<()> { fn main() { let path = "internal_input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "--crate-name".to_string(), CRATE_NAME.to_string(), diff --git a/tests/ui-fulldeps/stable-mir/smir_visitor.rs b/tests/ui-fulldeps/stable-mir/smir_visitor.rs index d225d9773fe51..caf71de2556c4 100644 --- a/tests/ui-fulldeps/stable-mir/smir_visitor.rs +++ b/tests/ui-fulldeps/stable-mir/smir_visitor.rs @@ -183,14 +183,14 @@ impl mir::MutMirVisitor for TestMutVisitor { fn main() { let path = "sim_visitor_input.rs"; generate_input(&path).unwrap(); - let args = vec![ + let args = &[ "rustc".to_string(), "-Cpanic=abort".to_string(), "--crate-name".to_string(), CRATE_NAME.to_string(), path.to_string(), ]; - run!(args.clone(), test_visitor).unwrap(); + run!(args, test_visitor).unwrap(); run!(args, test_mut_visitor).unwrap(); }