]> git.proxmox.com Git - rustc.git/blame - src/test/ui/span/regions-escape-loop-via-variable.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / span / regions-escape-loop-via-variable.rs
CommitLineData
223e47cc 1fn 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}