logoalt Hacker News

loegyesterday at 6:14 PM1 replyview on HN

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


Replies

Cyph0nyesterday at 10:07 PM

It is safe btw. The difference is that it returns two mutable references vs. one shared ref and one mutable ref. But as they noted, a mutable ref can always be “downgraded” into a shared ref.

show 1 reply