]> git.lizzy.rs Git - rust.git/blob - src/test/ui/span/regions-escape-loop-via-variable.rs
Rollup merge of #87922 - Manishearth:c-enum-target-spec, r=nagisa,eddyb
[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 }