This might be a silly question (I've spent my whole career in languages that don't offer much control), but: does it matter - with regard to these borrowed references - whether the item is on the heap or the stack, or can one have borrowed references to either?
I'm guessing the answer is the latter since I believe "let x = 5" in the examples doesn't box the integer. But I thought I should ask to confirm that suspicion.
You can have references to values on the heap or on the stack, and to whole objects or to single fields in a struct/enum/tuple/vector (though that might freeze the whole containing object).
I'm guessing the answer is the latter since I believe "let x = 5" in the examples doesn't box the integer. But I thought I should ask to confirm that suspicion.