Closed Archsx closed 1 week ago
I'm still learning this, but perhaps it's because the variable rect
is no longer used after that point in the program, so it loses all permissions.
I redid this example in aquascope (the program that makes these type of borrow-checking figures in the book) but used rect
one more time after it was aliased and this is what I got:
@twhentschel's explanation is exactly correct. It's an open issue in Aquascope to make these cases clearer. Hopefully we will improve this soon. See: cognitive-engineering-lab/aquascope#85
main
branch to see if this has already been fixed, in this file:URL to the section(s) of the book with this problem: https://rust-book.cs.brown.edu/ch05-03-method-syntax.html Description of the problem:
when using a immutable reference to refer a variable, it shows the variable(rect) losses the
R
permission.Suggested fix: