From: Simonas Kazlauskas Date: Mon, 11 Jan 2016 19:17:52 +0000 (+0200) Subject: Rollup merge of #30761 - nagisa:mir-fix-destination, r=michaelwoerister X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=04906061d8ec787757d27a94894d8674485e76e3;p=rust.git 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 --- 04906061d8ec787757d27a94894d8674485e76e3