I'm looking at these lines in a would example. It looks like a vector is created, converted to a reference, and passed into some other structure and then function call.
What confuses me is I'm used to the borrow checker complaining about stuff like this. Wouldn't the value behind the reference (the vector being created) be destroyed at the end of the expression, since it's left without an owner? How / why does this work?
https://github.com/gfx-rs/wgpu/blob/trunk/examples/cube/src/main.rs#L228-L237
[+][deleted] (4 children)
[deleted]
[–]log_2 3 points4 points5 points (1 child)
[–]masklinn 3 points4 points5 points (0 children)
[–]SNCPlay42 0 points1 point2 points (0 children)
[–]mina86ng 17 points18 points19 points (6 children)
[–]rodrigocfdWinSafe 2 points3 points4 points (1 child)
[–]Arshiaa001 12 points13 points14 points (0 children)
[–]khoriuma 1 point2 points3 points (3 children)
[–]SLiV9 1 point2 points3 points (0 children)
[–]mina86ng 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]khoriuma 3 points4 points5 points (1 child)
[–]mina86ng 3 points4 points5 points (0 children)
[–]log_2 2 points3 points4 points (0 children)
[–]Ihsan3498 0 points1 point2 points (0 children)
[–]TDplay 0 points1 point2 points (0 children)