> I don't understand how the alias checker figures into it. It's a lifetime > thing. How do you ensure the aliased value remains live as long as the alias > does?
Right, I was too vague on that. You can only return aliases that are 'rooted' (by the rules I explained in the previous alias-checking discussion) in arguments to the current function that were passed by alias. This ensures that the alias is still live when returned. (It might in some situations be difficult to prove this rooting, I haven't thought too deeply about that yet.) On the callee side, the alias checker knows that the returned alias is rooted in one of the arguments passed to the call that created it. Sometimes it can pinpoint the exact argument using type analysis (an int won't root a str, and only stuff passed by alias must be considered). It then disallows 'displacement' (overwriting, moving out of, or for mutable containers, taking the value of) of these roots until the last use of the returned alias. _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
