Skip to content
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

trpl: Refactor returning closures section #28588

Merged
merged 1 commit into from
Sep 26, 2015
Merged

trpl: Refactor returning closures section #28588

merged 1 commit into from
Sep 26, 2015

Conversation

critiqjo
Copy link

@rust-highfive
Copy link
Collaborator

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.
Copy link
Member

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?

Copy link
Author

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"..!

Copy link
Member

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.

@critiqjo
Copy link
Author

How does it look now? (I'll rebase it tomorrow if it seems okay to you)

@critiqjo
Copy link
Author

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
Copy link
Member

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 👍

@steveklabnik
Copy link
Member

r=me after the nit is fixed, and the commits are squashed

@critiqjo
Copy link
Author

@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 😅)

@steveklabnik
Copy link
Member

@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 👍 )

@steveklabnik
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Sep 24, 2015

📌 Commit 09d4dee has been approved by steveklabnik

@critiqjo
Copy link
Author

Oh! I misunderstood this:

r=me after ...

So r=me simply meant reply/ping me (since there's no notification for commit changes), huh!

@steveklabnik
Copy link
Member

steveklabnik commented Sep 24, 2015 via email

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Sep 25, 2015
bors added a commit that referenced this pull request Sep 25, 2015
@bors bors merged commit 09d4dee into rust-lang:master Sep 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants