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

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.


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...




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

Search: