-
Notifications
You must be signed in to change notification settings - Fork 13.3k
trpl: Refactor returning closures section #28588
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
The error also points out that the return type is expected to be a reference, | ||
but what we are trying to return is not. Further, it's not possible to simply | ||
— create an object and make it static, so as to — return a static | ||
reference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little concerned about this wording, but I can't quite articulate why. Also, why the dashes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am too... 😄 Please suggest a better wording... The dashes are there so that "create an object and make it static" is taken together when applying "not possible to"..!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, i see. Yeah, that's not exactly how dashes are usually used, they're used in place of commas or parenthesis, and you wouldn't do that with
so as to, return a static
which is why it seems awkward.
How does it look now? (I'll rebase it tomorrow if it seems okay to you) |
There was a mistake in the last commit, which should be fixed now... |
|
||
So what to do? This _almost_ works: | ||
The error also points out that the return type is expected to be a reference, | ||
but what we are trying to return is not. Further, we cannot simply assign static |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this to
we cannot directly assign a
'static
lifetime to an object. So we'll
After that, this should be good to go 👍
r=me after the nit is fixed, and the commits are squashed |
@bors r=steveklabnik rollup I hope rollup is the right thing to do... (been staring at that line for 5 minutes... ok let's click the green button 😅) |
@critiqjo bors only listens to those who have access, so don't worry, you can't screw it up.. yet :) (you did get the right syntax, regardless 👍 ) |
@bors: r+ rollup |
📌 Commit 09d4dee has been approved by |
Oh! I misunderstood this:
So r=me simply meant reply/ping me (since there's no notification for commit changes), huh! |
It's a signal to anyone else who _does_ have commit to do exactly what you
did, signing off for me.
|
r? @steveklabnik