]> git.proxmox.com Git - rustc.git/blame - src/test/ui/nll/polonius/call-kills-loans.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / nll / polonius / call-kills-loans.rs
CommitLineData
416331ca
XL
1// `Call` terminators can write to a local which has existing loans
2// and those need to be killed like a regular assignment to a local.
3// This is a simplified version of issue 47680, is correctly accepted
4// by NLL but was incorrectly rejected by Polonius because of these
5// missing `killed` facts.
6
7// check-pass
923072b8 8// compile-flags: -Z polonius
416331ca
XL
9
10struct Thing;
11
12impl Thing {
13 fn next(&mut self) -> &mut Self { unimplemented!() }
14}
15
16fn main() {
17 let mut temp = &mut Thing;
18
19 loop {
20 let v = temp.next();
21 temp = v; // accepted by NLL, was incorrectly rejected by Polonius
22 }
23}