News for hackers. Stuff that matters.
Re:Cursed Rust by dabacaba on Saturday October 05, 2024 @07:41PM (#41753664)
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.
Re:Cursed Rust by John23832 on Sunday October 06, 2024 @07:44AM (#41756439)
Interesting. Is there any documentation which explains this?
Re:Cursed Rust by eddyb on Sunday October 06, 2024 @01:29PM (#41758617)
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...