-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
example in chapter Ownership
seems not correct
#87
Comments
I believe here we need to introduce what the end of scope is. |
Hi @Yansongsongsong, You are completely correct that the error message is about scopes and that the instructor will have to explain what a scope is at this point. That is normally super easy, though, since the course participants already know how to program. To my knowledge, a scope in Rust is the same as a scope in C++ (please correct me if I'm wrong?) and so I normally tell the students that. To me, ownership is mostly a matter of who should deallocate this value when it goes out of scope? So that is why I start the discussion of borrowing and ownership with scopes. We should eventually write something about this into speaker notes #53. |
hi @mgeisler , Feel free to close this issue at any time. |
Thanks, I'll close it for now. |
In
Ownership
chapter we give one example to indicate that variable will be dropped at the end of scope.But actually the rustc’s complaining is
I believe this example may cause confusion.
The text was updated successfully, but these errors were encountered: