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
Documentation: Unclear difference between "string slices" and "string literals" for newcomers #29823
Comments
To be clear: a string literal is just a string slice that lives forever (because it's a pointer into the binary's rodata or whatever). |
@gandro, yep, but looks like it is not obvious for newcomers. I think we should make these lines in the book more clear. |
Yep, always a great thing to do! Just clarifying for whoever wants to fix this up. |
JanLikar
added a commit
to JanLikar/rust
that referenced
this issue
Nov 15, 2015
Fix rust-lang#29823 by further explaining `&str` and pointing out the difference between `&str` and `&'static str`.
bors
added a commit
that referenced
this issue
Nov 15, 2015
Fix #29823 by further explaining `&str` and pointing out the difference between `&str` and `&'static str`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From "Strings" chapter:
The problem is that a beginner who reads these lines can make a false conclusion that "string slice" and "string literal" mean the same thing, and string slices always has a static lifetime.
Comment from newcomer:
The text was updated successfully, but these errors were encountered: