about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-11-28 05:38:19 +0000
committerbors <bors@rust-lang.org>2017-11-28 05:38:19 +0000
commit7745a7a8177259cd2ea0b48eaf35dd943eec2896 (patch)
tree71bbe2a721b54dd17566f0fc55eb37a068bd50c4 /src/libstd/sys/unix/stack_overflow.rs
parent3e9a7f7fbbf2898b9f1d60886f92e76370040d83 (diff)
parent919ed409b0fbb56bcd6c70ff50bfc9275c4b7701 (diff)
downloadrust-7745a7a8177259cd2ea0b48eaf35dd943eec2896.tar.gz
rust-7745a7a8177259cd2ea0b48eaf35dd943eec2896.zip
Auto merge of #46142 - eddyb:even-mirer-2, r=nikomatsakis
MIR: split Operand::Consume into Copy and Move.

By encoding the choice of leaving the source untouched (`Copy`) and invalidating it (`Move`) in MIR, we can express moves of copyable values and have MIR borrow-checking enforce them, *including* ownership transfer of stack locals in calls  (when the ABI passes by indirection).

Optimizations could turn a "last-use" `Copy` into a `Move`, and the MIR borrow-checker, at least within the confines of safe code, could even do this when the underlying lvalue was borrowed.
(However, that last part would be the first time lifetime inference affects code generation, AFAIK).

Furthermore, as `Move`s invalidate borrows as well, for any local that is initialized only once, we can ignore borrows that happened before a `Move` and safely reuse/replace its memory storage.
This will allow us to perform NRVO in the presence of short-lived borrows, unlike LLVM (currently), and even compute optimal `StorageLive...StorageDead` ranges instead of discarding them.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions