logoalt Hacker News

aw1621107today at 8:20 AM0 repliesview on HN

No, in general Rust doesn't (and can't) know whether an arbitrary function has side effects. The compiler does arguably have a leg up since Rust code is typically all built from source, but there's still things like FFI that act as visibility barriers for the compiler.