diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2017-10-04 17:46:46 +0200 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2017-10-11 22:35:02 +0200 |
| commit | dcada26f5b1d83c4e51d9bdf0c7304ed497a63c6 (patch) | |
| tree | e5b06a45d7d4b2ed5868bc1745a276565e26c90e /src/test/run-pass/thinlto | |
| parent | 5f578dfad0dd5d43b28eff71a7e857d10c3f55fe (diff) | |
| download | rust-dcada26f5b1d83c4e51d9bdf0c7304ed497a63c6.tar.gz rust-dcada26f5b1d83c4e51d9bdf0c7304ed497a63c6.zip | |
MIR-borrowck: Big fix to `fn check_if_path_is_moved`.
Fix #44833 (a very specific instance of a very broad bug).
In `check_if_path_is_moved(L)`, check nearest prefix of L with
MovePath, and suffixes of L with MovePaths.
Over the course of review, ariel pointed out a number of issues that
led to this version of the commit:
1. Looking solely at supporting prefixes does not suffice: it
overlooks checking if the path was ever actually initialized in the
first place. So you need to be willing to consider non-supporting
prefixes. Once you are looking at all prefixes, you *could* just
look at the local that forms the base of the projection, but to
handle partial initialization (which still needs to be formally
specified), this code instead looks at the nearest prefix of L that
has an associated MovePath (which, in the limit, will end up being
a local).
2. You also need to consider the suffixes of the given Lvalue, due to
how dataflow is representing partial moves of individual fields out
of struct values.
3. (There was originally a third search, but ariel pointed out that
the first and third could be folded into one.)
Also includes some drive-by refactorings to simplify some method
signatures and prefer `for _ in _` over `loop { }` (at least when it
comes semi-naturally).
Diffstat (limited to 'src/test/run-pass/thinlto')
0 files changed, 0 insertions, 0 deletions
