Hacker News new | ask | show | jobs
by dabacaba 615 days ago
In Rust, if expressions are not place expressions. In the example, arr_ref is a reference to a temporary, not to an array element. In Rust, it is possible to take an address of any expression, but taking an address of a value expression will produce an address of a temporary.
1 comments

Interesting. Is there any documentation which explains this?
Not sure if there's a better section elsewhere, but at least this one touches on it: https://doc.rust-lang.org/reference/destructors.html#tempora...