Hacker News new | ask | show | jobs
by leshow 3198 days ago
Isn't the mutable borrow ended after the end of the x += 1 line? leaving you free to read the contents of the ptr?

I don't know swift at all. but from their document on swapAt() it looks like they are trying to prevent two fn(&p, &p) where func fn(a: inout Type, b: inout Type)

1 comments

> Isn't the mutable borrow ended after the end of the x += 1 line?

No, see Mike's comment here.