3 ms·
But if ownership was returned then it could be freed in main. And because it was allocated on the stack in the first place there doesn't seem to be any reasona
by Symmetry 10y ago
But if ownership was returned then it could be freed in main. And because it was allocated on the stack in the first place there doesn't seem to be any reasonable way for the callee to, say, return a reference to an element of the vector because then the caller could return that reference again but then you'd have a value still referred to by the outside context sitting where the stack should be able to grow so I assume that Rust would disallow this and force you to make a copy of anything you want to return.