about summary refs log tree commit diff
path: root/src/rustllvm/Linker.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-02-09 02:26:43 +0000
committerbors <bors@rust-lang.org>2018-02-09 02:26:43 +0000
commitafa8acce251cda7ab1548640fdb769139a45f839 (patch)
treebc933826b368226427af8894bc4de82291c7ea9a /src/rustllvm/Linker.cpp
parent932c736479f43dc8893a924946e4335d8e308c2e (diff)
parentb55cd8cc7c55a50941cc55cd399f6d5aebdf77f8 (diff)
downloadrust-afa8acce251cda7ab1548640fdb769139a45f839.tar.gz
rust-afa8acce251cda7ab1548640fdb769139a45f839.zip
Auto merge of #47489 - pnkfelix:limit-2pb-issue-46747, r=nikomatsakis
NLL: Limit two-phase borrows to autoref-introduced borrows

This imposes a restriction on two-phase borrows so that it only applies to autoref-introduced borrows.

The goal is to ensure that our initial deployment of two-phase borrows is very conservative. We want it to still cover the `v.push(v.len());` example, but we do not want it to cover cases like `let imm = &v; let mu = &mut v; mu.push(imm.len());`

(Why do we want it to be conservative? Because when you are not conservative, then the results you get, at least with the current analysis, are tightly coupled to details of the MIR construction that we would rather remain invisible to the end user.)

Fix #46747

I decided, for this PR, to add a debug-flag `-Z two-phase-beyond-autoref`, to re-enable the more general approach. But my intention here is *not* that we would eventually turn on that debugflag by default; the main reason I added it was that I thought it was useful for writing tests to be able to write source that looks like desugared MIR.
Diffstat (limited to 'src/rustllvm/Linker.cpp')
0 files changed, 0 insertions, 0 deletions