]>
Commit | Line | Data |
---|---|---|
223e47cc | 1 | fn main() { |
85aaf69f | 2 | let x = 3; |
223e47cc LB |
3 | |
4 | // Here, the variable `p` gets inferred to a type with a lifetime | |
5 | // of the loop body. The regionck then determines that this type | |
6 | // is invalid. | |
7 | let mut p = &x; | |
8 | ||
9 | loop { | |
85aaf69f | 10 | let x = 1 + *p; |
ff7c6d11 | 11 | p = &x; |
223e47cc | 12 | } |
ff7c6d11 | 13 | //~^^ ERROR `x` does not live long enough |
223e47cc | 14 | } |