about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorSimonas Kazlauskas <git@kazlauskas.me>2016-01-07 15:08:02 +0200
committerSimonas Kazlauskas <git@kazlauskas.me>2016-01-08 14:40:32 +0200
commit2f86c1605c3a82d0c82c36f1dc84441237a9f5c1 (patch)
tree6dc0722392fa53ac91df50f3b83bfb05e5327419 /src/rustllvm/RustWrapper.cpp
parent64a8ffeffaae2fe72994fb0832ae525346b8a3c0 (diff)
downloadrust-2f86c1605c3a82d0c82c36f1dc84441237a9f5c1.tar.gz
rust-2f86c1605c3a82d0c82c36f1dc84441237a9f5c1.zip
Change destination accessor to return references
Previously it was returning a value, 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.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions