2017-11-10 00:07:32 -05:00
|
|
|
struct Wrap<'a> { w: &'a mut u32 }
|
|
|
|
|
|
|
|
fn foo() {
|
2017-11-11 15:32:07 -05:00
|
|
|
let mut x = 22;
|
2017-11-10 00:07:32 -05:00
|
|
|
let wrapper = Wrap { w: &mut x };
|
2019-04-22 08:40:08 +01:00
|
|
|
x += 1; //~ ERROR cannot use `x` because it was mutably borrowed [E0503]
|
2017-11-10 00:07:32 -05:00
|
|
|
*wrapper.w += 1;
|
|
|
|
}
|
|
|
|
|
2017-11-19 23:37:59 +01:00
|
|
|
fn main() { }
|