]> git.lizzy.rs Git - rust.git/blob - src/test/ui/span/regions-escape-loop-via-variable.rs
Merge commit '40dd3e2b7089b5e96714e064b731f6dbf17c61a9' into sync_cg_clif-2021-05-27
[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 }