]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/reference-carried-through-struct-field.rs
Rollup merge of #103644 - catlee:catlee/option-question-mark-docs, r=workingjubilee
[rust.git] / src / test / 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() { }