Debian Codegraph @

gcc/testsuite/rust/borrowck/position_dependant_outlives.rs

raw
1 // { dg-additional-options "-frust-compile-until=compilation -frust-borrowcheck" }
2
3 pub fn position_dependent_outlives<'a>(x: &'a mut i32, cond: bool) -> &'a mut i32 {
4 let y = &mut *x;
5 if cond {
6 return y;
7 } else {
8 *x = 0;
9 return x;
10 }
11 }