I’m new to Rust, though a very experienced programmer (now retired, I wrote my first program on an IBM 1620 in assembly language in 1960!). Here’s the issue:
In the References and Borrowing section, we are taught that creating a reference “borrows ownership”. Subsequently, in “Thinking in Scopes”, we are told that an inner scope is needed for the mutable borrow, because the println! creates an immutable borrow. Well, the println! looks like this:
If you forget that println! is a macro, not a function, then you become confused, since passing the argument ‘x’ to a function does not constitute borrowing. The fact that the println! creates an immutable borrow only becomes apparent if you remember that println! is a macro and you look at how how it expands. I think the text ought to say this explicitly. Perhaps I’ve missed something (if so, please enlighten me), but I think the current presentation is not clear and explicit enough.