]> git.lizzy.rs Git - rust.git/commit
Fix `auto_ref()` for fat pointers
authorBjörn Steinbrink <bsteinbr@gmail.com>
Sun, 27 Dec 2015 16:56:15 +0000 (17:56 +0100)
committerBjörn Steinbrink <bsteinbr@gmail.com>
Sun, 27 Dec 2015 16:57:49 +0000 (17:57 +0100)
commit575f690b39559160e31930726b5629dfbd3526fa
treef38e3884fff7f4e2a22256a94cfd80e8a33d367e
parent38201501dfe193bfa14d792f590effd462a78717
Fix `auto_ref()` for fat pointers

`auto_ref()` currently returns an Rvalue datum for the ref'd value,
which is fine for thin pointers, but for fat pointers this means that
once the pointer is moved out of that datum, its memory will be marked
as dead. And because there is not necessarily an intermediate temporary
involved we can end up marking memory as dead that is actually still
used.

As I don't want to break the micro-optimization for thin pointers by
always returning an Lvalue datum, I decided to only do so for fat
pointers.

Fix #30478
src/librustc_trans/trans/expr.rs