]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/issue-52713-bug.rs
460e6b4bbae4d9b2d8b7b52f4a5d74675ab13274
[rust.git] / src / test / ui / borrowck / issue-52713-bug.rs
1 // Regression test for a bug in #52713: this was an optimization for
2 // computing liveness that wound up accidentally causing the program
3 // below to be accepted.
4
5 #![feature(nll)]
6
7 fn foo<'a>(x: &'a mut u32) -> u32 {
8     let mut x = 22;
9     let y = &x;
10     if false {
11         return x;
12     }
13
14     x += 1; //~ ERROR
15     println!("{}", y);
16     return 0;
17 }
18
19 fn main() { }