-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
&5 isn't on the stack #455
Comments
In general, mentioning the stack is a bad idea. The lack of indirection is a great concept without a good name AFAIK (e.g. the fields of the struct having the same storage as the struct itself). But more specifically: |
I have no idea where either the old book or the new book says this, so i'm assigning this one to you, @steveklabnik |
i dont think this exists anymore, reopen and tell me where to fix what if i'm wrong :) |
First edition(F.E.) book says it here: https://github.com/rust-lang/book/blob/master/first-edition/src/lifetimes.md#in-structs
I've just stumbled upon this in this playground example - to test, switch between Debug and Release modes to see where compile fails respectively succeeds, the latter being due to this rvalue static promotion (thanks to scottmcm on irc) In other words, that statement that F.E. makes is incorrect. Second Edition book doesn't seem to make any such comment. EDIT: Also, the statement (which slightly below the above quote, on the same section)
seems to be false when rvalue static promotion is at play.
|
That last statement is still correct: if a reference to the |
Thanks! We're no longer actively working on the first edition, but if you send in a PR to fix the problem, we'll merge it. |
edit: nevermind Well, there is more: in https://github.com/rust-lang/book/blob/master/first-edition/src/lifetimes.md#thinking-in-scopes
It is unclear what's the type of EDIT: thanks to irc user durka42:
EDIT2: thanks eddyb (below) I didn't notice the reply until after |
@xftroxgpx If you pick But if the type is |
so says @eddyb
I'm filing this here because I know the old book says this incorrectly, and I'm pretty sure the new one does too. We should investigate and fix, regardless.
https://www.reddit.com/r/rust/comments/5uypl3/let_z_42/ddyesib/?context=3&st=izdc2w0s&sh=f5e495c6
The text was updated successfully, but these errors were encountered: