]> git.lizzy.rs Git - rust.git/blob - src/test/ui/in-band-lifetimes/mut_while_borrow.rs
Auto merge of #75936 - sdroege:chunks-exact-construction-bounds-check, r=nagisa
[rust.git] / src / test / ui / in-band-lifetimes / mut_while_borrow.rs
1 #![allow(warnings)]
2 #![feature(in_band_lifetimes)]
3
4 fn foo(x: &'a u32) -> &'a u32 { x }
5
6 fn main() {
7     let mut p = 3;
8     let r = foo(&p);
9     p += 1; //~ ERROR cannot assign to `p` because it is borrowed
10     println!("{}", r);
11 }