Closed
Description
After reading reading The Book, readers get an idea when named variables are being dropped. For temporary values (which I tend to call 'anonymous values') however, I couldn't find any part in The Book that indicates when these are dropped.
When I didn't know when temporaries will be dropped, I used my intuition to fill the gap in my knowledge. Because my intuition was incorrect, I could have written code that does not behave as I would expect. An example of how this can lead to bugs can be found in rust-lang/rust#37612. For this reason, I think it is worth mentioning when temporaries are dropped.
The reference includes a section explaining when temporary values will be dropped.
Metadata
Metadata
Assignees
Labels
No labels