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

Suggest correct place to add self parameter when inside closure #78048

Merged
merged 1 commit into from
Oct 17, 2020

Conversation

blyxxyz
Copy link
Contributor

@blyxxyz blyxxyz commented Oct 17, 2020

It would incorrectly suggest adding it as a parameter to the closure instead of the containing function.

For example:

help: add a `self` receiver parameter to make the associated `fn` a method
  |
5 |         let _ = || self&self;
  |                        ^^^^^

DiagnosticMetadata.current_function is only used for these messages so tweaking its behavior should be ok.

It would incorrectly suggest adding it as a parameter to the closure instead of the
containing function.
@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 @lcnr (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. Due to 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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 17, 2020
Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@lcnr
Copy link
Contributor

lcnr commented Oct 17, 2020

cc @estebank

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 17, 2020

📌 Commit e701ae3 has been approved by lcnr

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 17, 2020
@camelid camelid added A-diagnostics Area: Messages for errors, warnings, and lints A-closures Area: Closures (`|…| { … }`) labels Oct 17, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 17, 2020
Rollup of 7 pull requests

Successful merges:

 - rust-lang#75802 (resolve: Do not put nonexistent crate `meta` into prelude)
 - rust-lang#76607 (Modify executable checking to be more universal)
 - rust-lang#77851 (BTreeMap: refactor Entry out of map.rs into its own file)
 - rust-lang#78043 (Fix grammar in note for orphan-rule error [E0210])
 - rust-lang#78048 (Suggest correct place to add `self` parameter when inside closure)
 - rust-lang#78050 (Small CSS cleanup)
 - rust-lang#78059 (Set `MDBOOK_OUTPUT__HTML__INPUT_404` on linkchecker)

Failed merges:

r? `@ghost`
@bors bors merged commit 57e38dd into rust-lang:master Oct 17, 2020
@rustbot rustbot added this to the 1.49.0 milestone Oct 17, 2020
@blyxxyz blyxxyz deleted the e0424-improve-self-placement branch October 17, 2020 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: Closures (`|…| { … }`) A-diagnostics Area: Messages for errors, warnings, and lints S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants