diff options
| author | lqd <remy.rakic+github@gmail.com> | 2019-07-15 15:54:43 +0200 |
|---|---|---|
| committer | lqd <remy.rakic+github@gmail.com> | 2019-07-22 11:36:42 +0200 |
| commit | 6d9a4f978313798a275a150ffd0f103609484ebd (patch) | |
| tree | 4872f59aae9999e573fa933c4264225507981c5d /src/test/ui/nll/polonius | |
| parent | 9a82f52e59c39e3a101a51cc6902ab0064c61c6a (diff) | |
| download | rust-6d9a4f978313798a275a150ffd0f103609484ebd.tar.gz rust-6d9a4f978313798a275a150ffd0f103609484ebd.zip | |
Polonius facts: kill loans on Call terminators and StorageDead
Diffstat (limited to 'src/test/ui/nll/polonius')
| -rw-r--r-- | src/test/ui/nll/polonius/calls-kill-loans.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/nll/polonius/calls-kill-loans.rs b/src/test/ui/nll/polonius/calls-kill-loans.rs new file mode 100644 index 00000000000..31215714788 --- /dev/null +++ b/src/test/ui/nll/polonius/calls-kill-loans.rs @@ -0,0 +1,24 @@ +// `Call` terminators can write to a local which has existing loans +// and those need to be killed like a regular assignment to a local. +// This is a simplified version of issue 47680, is correctly accepted +// by NLL but was incorrectly rejected by Polonius because of these +// missing `killed` facts. + +// build-pass +// compile-flags: -Z borrowck=mir -Z polonius +// ignore-compare-mode-nll + +struct Thing; + +impl Thing { + fn next(&mut self) -> &mut Self { unimplemented!() } +} + +fn main() { + let mut temp = &mut Thing; + + loop { + let v = temp.next(); + temp = v; // accepted by NLL, was incorrectly rejected by Polonius + } +} |
