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