blob: 04900da8ae5e5185fbdfa2f2cc6f9195eca63316 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
fn main() {
let x = 3;
// Here, the variable `p` gets inferred to a type with a lifetime
// of the loop body. The regionck then determines that this type
// is invalid.
let mut p = //~ ERROR reference is not valid
&x;
loop {
let x = 1 + *p;
p = &x;
}
}
|