Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you take a Rust for loop, de-sugar it to produce the actual loop { } which would run, and then modify that loop to have the Go semantics - with a single long-lived variable which is re-assigned each iteration, Rust detects the faulty Go cases of course.

[Edited: I tried to explain what's going on here, but I don't think my explanation was helpful so I've just left the surface]



> Rust detects the faulty Go cases of course

Yes Rust’s ownership rules make it rather complicated to reproduce the faulty behaviour, as it’s about sharing mutable state which Rust intensely dislikes. You’d need to wilfully share (and update) internally mutable structures (cells, atomics) which is pretty noticeable and not something you do by mistake.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: