]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-46589.rs
fix merge conflicts
[rust.git] / src / test / ui / nll / issue-46589.rs
1 struct Foo;
2
3 impl Foo {
4     fn get_self(&mut self) -> Option<&mut Self> {
5         Some(self)
6     }
7
8     fn new_self(&mut self) -> &mut Self {
9         self
10     }
11
12     fn trigger_bug(&mut self) {
13         let other = &mut (&mut *self);
14
15         *other = match (*other).get_self() {
16             Some(s) => s,
17             None => (*other).new_self()
18             //~^ ERROR cannot borrow `**other` as mutable more than once at a time [E0499]
19         };
20
21         let c = other;
22     }
23 }
24
25 fn main() {}