5 ms·
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 ta
by dabacaba 2y 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.
- John23832 2y agoInteresting. Is there any documentation which explains this?
- eddyb 2y agoNot sure if there's a better section elsewhere, but at least this one touches on it: https://doc.rust-lang.org/reference/destructors.html#temporary-scopes https://doc.rust-lang.org/reference/destructors.html#tempora...
- justincredible 2y ago[dead]