logoalt Hacker News

oneshteinyesterday at 10:42 AM1 replyview on HN

  fn f() {
    let mut v = vec![1, 2, 3, 4, 5];
    let (header, tail) = v.split_at_mut(1);
    b(&header[0], &mut tail[0]);
  }

Replies

loegyesterday at 6:14 PM

split_at_mut is just unsafe code (and sibling comment mentioned it hours before you did). The borrow checker doesn't natively understand that.

show 1 reply