-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Move semantics example on front page of book is problematic #25918
Comments
Ahhh bummer. :( I mean, good for the code, but terrible for me. |
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
Nov 5, 2015
Originally, this was my 30 minute introduction, and we eventually made it the opener to the book. But as rust-lang#25918 has shown, the example I use here has some issues. The good news is that Rust makes heap allocation syntatically expensive, but the bad news is that that means showing equivalent programs from Rust and other languages is difficult. After thinking about it, I'm not sure this section is pulling its weight, and since it has problems, I'd rather just pull it than try to re-write it right now. I think the book is fine without it. FIxes rust-lang#25918
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
Nov 5, 2015
Originally, this was my 30 minute introduction, and we eventually made it the opener to the book. But as rust-lang#25918 has shown, the example I use here has some issues. The good news is that Rust makes heap allocation syntatically expensive, but the bad news is that that means showing equivalent programs from Rust and other languages is difficult. After thinking about it, I'm not sure this section is pulling its weight, and since it has problems, I'd rather just pull it than try to re-write it right now. I think the book is fine without it. FIxes rust-lang#25918
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://doc.rust-lang.org/nightly/book/
The type of
x
isVec<&'static str>
. It's not necessary to clone anything here, because reference types are Copy. Even callingx[0].clone()
is just copying the pointer into y, not making a copy of the string.The text was updated successfully, but these errors were encountered: