> (1) Handing out aliases to local variables and function parameters > (directly, not substructures thereof) is always safe. The calling function > is the only one that can possibly provide access its own locals, and it's > suspended for the duration of the call.
Except for upvars. 'for each' bodies can already mess with locals that were passed by alias to the iterator. We'll want to expand this with generalized non-escaping lambda. > (2) Unique pointers inside data structures can be, in effect, promoted to > local variables by swapping them with a local. The resulting local variable > can then be handed off as an alias safely per point (1). Wouldn't this A) require the field to be mutable, and B) put it in an inconsistent state until the value is swapped back in? Also, I think there's a definite (and low) upper limit on how complex we can make this without making the language unusable. _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
