]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/reference-carried-through-struct-field.rs
Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco
[rust.git] / tests / ui / nll / reference-carried-through-struct-field.rs
1 struct Wrap<'a> { w: &'a mut u32 }
2
3 fn foo() {
4     let mut x = 22;
5     let wrapper = Wrap { w: &mut x };
6     x += 1; //~ ERROR cannot use `x` because it was mutably borrowed [E0503]
7     *wrapper.w += 1;
8 }
9
10 fn main() { }