QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#876690#6409. Classical Data Structure Problemucup-team3685Compile Error//Rust5.3kb2025-01-31 11:11:362025-01-31 11:11:38

詳細信息

error[E0382]: borrow of moved value: `self`
  --> answer.code:88:53
   |
64 |     fn split(&mut self, m: i64) {
   |              --------- move occurs because `self` has type `&mut Node`, which does not implement the `Copy` trait
...
88 |         while self.c[0].as_ref().unwrap().height >= self.c[1].as_ref().unwrap().height + 2 {
   |         --------------------------------------------^^^^^^^^^-----------------------------
   |         |                                           |
   |         |                                           value borrowed here after move
   |         inside of this loop
89 |             let a = self;
   |                     ---- value moved here, in previous iteration of loop

error[E0596]: cannot borrow `b.c[_]` as mutable, as `b` is not declared as mutable
   --> answer.code:90:17
    |
90  |             let b = a.c[0].take().unwrap();
    |                 ^ not mutable
91  |             let x = b.c[0].take().unwrap();
    |                     ------ cannot borrow as mutable
92  |             let y = b.c[1].take().unwrap();
    |                     ------ cannot borrow as mutable
...
96  |             b.push();
    |             - cannot borrow as mutable
...
112 |             b.pull();
    |             - cannot borrow as mutable
    |
help: consider changing this to be mutable
    |
90  |             let mut b = a.c[0].take().unwrap();
    |                 +++

error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable
   --> answer.code:91:17
    |
91  |             let x = b.c[0].take().unwrap();
    |                 ^ not mutable
...
97  |             x.push();
    |             - cannot borrow as mutable
...
109 |             x.pull();
    |             - cannot borrow as mutable
    |
help: consider changing this to be mutable
    |
91  |             let mut x = b.c[0].take().unwrap();
    |                 +++

error[E0596]: cannot borrow `*y` as mutable, as `y` is not declared as mutable
   --> answer.code:92:17
    |
92  |             let y = b.c[1].take().unwrap();
    |                 ^ not mutable
...
98  |             y.push();
    |             - cannot borrow as mutable
...
110 |             y.pull();
    |             - cannot borrow as mutable
    |
help: consider changing this to be mutable
    |
92  |             let mut y = b.c[1].take().unwrap();
    |                 +++

error[E0596]: cannot borrow `*z` as mutable, as `z` is not declared as mutable
   --> answer.code:93:17
    |
93  |             let z = a.c[1].take().unwrap();
    |                 ^ not mutable
...
99  |             z.push();
    |             - cannot borrow as mutable
...
111 |             z.pull();
    |             - cannot borrow as mutable
    |
help: consider changing this to be mutable
    |
93  |             let mut z = a.c[1].take().unwrap();
    |                 +++

error[E0594]: cannot assign to `b.c[_]`, as `b` is not declared as mutable
   --> answer.code:103:13
    |
103 |             b.c[0] = Some(y);
    |             ^^^^^^ cannot assign
    |
help: consider changing this to be mutable
    |
90  |             let mut b = a.c[0].take().unwrap();
    |                 +++

error[E0382]: use of moved value: `b.c`
   --> answer.code:103:13
    |
90  |             let b = a.c[0].take().unwrap();
    |                 - move occurs because `b` has type `Box<Node>`, which does not implement the `Copy` trait
...
102 |             a.c[1] = Some(b);
    |                           - value moved here
103 |             b.c[0] = Some(y);
    |             ^^^^^^ value used here after move

error[E0594]: cannot assign to `b.c[_]`, as `b` is not declared as mutable
   --> answer.code:104:13
    |
104 |             b.c[1] = Some(z);
    |             ^^^^^^ cannot assign
    |
help: consider changing this to be mutable
    |
90  |             let mut b = a.c[0].take().unwrap();
    |                 +++

error[E0594]: cannot assign to `b.l`, as `b` is not declared as mutable
   --> answer.code:106:13
    |
106 |             b.l = y.l;
    |             ^^^^^^^^^ cannot assign
    |
help: consider changing this to be mutable
    |
90  |             let mut b = a.c[0].take().unwrap();
    |                 +++

error[E0382]: use of moved value: `y`
   --> answer.code:106:19
    |
92  |             let y = b.c[1].take().unwrap();
    |                 - move occurs because `y` has type `Box<Node>`, which does not implement the `Copy` trait
...
103 |             b.c[0] = Some(y);
    |                           - value moved here
...
106 |             b.l = y.l;
    |                   ^^^ value used here after move

error[E0594]: cannot assign to `b.r`, as `b` is not declared as mutable
   --> answer.code:107:13
    |
107 |             b.r = z.r;
    |             ^^^^^^^^^ cannot assign
    |
help: consider changing this to be mutable
    |
90  |             let mut b = a.c[0].take().unwrap();
    |                 +++

error[E0382]: use of moved value:...