fork download
  1. fn main() {
  2. let mut a = Vec::new();
  3. let b = &a;
  4. a.push(1);
  5. }
Compilation error #stdin compilation error #stdout 0s 0KB
Standard input is empty
compilation info 4:6 error: cannot borrow `a` as mutable because it is also borrowed as immutable     a.push(1);
              ^ 3:15 note: previous borrow of `a` occurs here; the immutable borrow prevents subsequent moves or mutable borrows of `a` until the borrow ends     let b = &a;
                       ^ 5:2 note: previous borrow ends here fn main() {     let mut a = Vec::new();     let b = &a;     a.push(1); }
error: aborting due to previous error
Standard output is empty