2019-07-15 08:54:43 -05:00
|
|
|
// `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.
|
|
|
|
|
2019-07-15 11:57:16 -05:00
|
|
|
//@ check-pass
|
2022-04-01 12:13:25 -05:00
|
|
|
//@ compile-flags: -Z polonius
|
2019-07-15 08:54:43 -05:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|