]> git.lizzy.rs Git - rust.git/blob - src/test/ui/span/regions-escape-loop-via-variable.rs
Merge commit 'b20d4c155d2fe3a8391f86dcf9a8c49e17188703' into clippyup
[rust.git] / src / test / ui / span / regions-escape-loop-via-variable.rs
1 fn main() {
2     let x = 3;
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 {
10         let x = 1 + *p;
11         p = &x;
12     }
13     //~^^ ERROR `x` does not live long enough
14 }