diff options
| author | Yuri Astrakhan <YuriAstrakhan@gmail.com> | 2024-07-19 11:51:21 -0400 |
|---|---|---|
| committer | Yuri Astrakhan <YuriAstrakhan@gmail.com> | 2024-07-19 14:52:07 -0400 |
| commit | c1c13bd07ca476c0d9b53b0fa1384ea8a83962e3 (patch) | |
| tree | 1f0a57170aabc15c11b0030b310e60490355ddeb | |
| parent | 25dce8f92b6d342f9aa70c8716f41f963b343b5c (diff) | |
| download | rust-c1c13bd07ca476c0d9b53b0fa1384ea8a83962e3.tar.gz rust-c1c13bd07ca476c0d9b53b0fa1384ea8a83962e3.zip | |
Avoid ref when using format! in compiler
Clean up a few minor refs in `format!` macro, as it has a performance cost. Apparently the compiler is unable to inline `format!("{}", &variable)`, and does a run-time double-reference instead (format macro already does one level referencing). Inlining format args prevents accidental `&` misuse.
| -rw-r--r-- | src/abi/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/abi/mod.rs b/src/abi/mod.rs index fa0de6f9de5..ac5aaea561c 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -505,7 +505,7 @@ pub(crate) fn codegen_terminator_call<'tcx>( let nop_inst = fx.bcx.ins().nop(); fx.add_comment( nop_inst, - format!("virtual call; self arg pass mode: {:?}", &fn_abi.args[0]), + format!("virtual call; self arg pass mode: {:?}", fn_abi.args[0]), ); } |
