about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorSimonas Kazlauskas <github@kazlauskas.me>2016-01-11 21:17:52 +0200
committerSimonas Kazlauskas <github@kazlauskas.me>2016-01-11 21:17:52 +0200
commit04906061d8ec787757d27a94894d8674485e76e3 (patch)
tree8044ea395ce3a1c5815c313001a8fd91b33c406f /src/rustllvm/RustWrapper.cpp
parentcaf6095fcfed3f57688fc64308e151ae35638c81 (diff)
parent2f86c1605c3a82d0c82c36f1dc84441237a9f5c1 (diff)
downloadrust-04906061d8ec787757d27a94894d8674485e76e3.tar.gz
rust-04906061d8ec787757d27a94894d8674485e76e3.zip
Rollup merge of #30761 - nagisa:mir-fix-destination, r=michaelwoerister
Previously it was returning a clone, mostly for the two reasons:

* Cloning Lvalue is very cheap most of the time (i.e. when Lvalue is not a Projection);
* There’s users who want &mut lvalue and there’s users who want &lvalue. Returning a value allows
  to make either one easier when pattern matching (i.e. Some(ref dest) or Some(ref mut dest)).

However, I’m now convinced this is an invalid approach. Namely the users which want a mutable
reference may modify the Lvalue in-place, but the changes won’t be reflected in the final MIR,
since the Lvalue modified is merely a clone.

Instead, we have two accessors `destination` and `destination_mut` which return a reference to the
destination in desired mode.

r? @nikomatsakis
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions