]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #45380 - dotdash:arg_copies, r=arielb1
authorbors <bors@rust-lang.org>
Thu, 26 Oct 2017 14:14:15 +0000 (14:14 +0000)
committerbors <bors@rust-lang.org>
Thu, 26 Oct 2017 14:14:15 +0000 (14:14 +0000)
Avoid unnecessary copies of arguments that are simple bindings

Initially MIR differentiated between arguments and locals, which
introduced a need to add extra copies assigning the argument to a
local, even for simple bindings. This differentiation no longer exists,
but we're still creating those copies, bloating the MIR and LLVM IR we
emit.

Additionally, the current approach means that we create debug info for
both the incoming argument (marking it as an argument), and then
immediately shadow it a local that goes by the same name. This can be
confusing when using e.g. "info args" in gdb, or when e.g. a debugger
with a GUI displays the function arguments separately from the local
variables, especially when the binding is mutable, because the argument
doesn't change, while the local variable does.


Trivial merge