blob: f430e9211e764e95854e1fa8f629dd53f335b24a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// `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.
// check-pass
// compile-flags: -Z polonius
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
}
}
|