Borrowing a unique pointer temporarily invalidates its type (the pointer is no longer unique). We need to ensure that the original unique pointer is inaccessible while the borrow alias exists (except, possibly to create other borrows). This will be done in a separate pass (I've actually implemented most of the code as part of #2046) which will check when a ~T is borrowed that either:
- the borrowee is an rvalue, in which case the only accessible copy is the borrowed ptr and everything is fine.
- the borrowee is an lvalue that is rooted in a local variable. This local variable is then made inaccessible for the scope of the borrow.
Borrowing a unique pointer temporarily invalidates its type (the pointer is no longer unique). We need to ensure that the original unique pointer is inaccessible while the borrow alias exists (except, possibly to create other borrows). This will be done in a separate pass (I've actually implemented most of the code as part of #2046) which will check when a
~Tis borrowed that either: