That worked in Rust 0.9? I guess that's one of the unsoundness bugs that was patched this cycle.
That code does indeed require multiple mutable borrows and so the 0.9 behaviour was not correct; the 0.10 behaviour is correct.
There are two things you can do:
- refactor your code so that this requirement is not necessary, or
- use
RefCell<T>
instead ofT
, to use runtime borrow checking. - use
Cell<T>
instead ofT
, maintaining a local copy of the object rather than doing borrowing.