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

Add intention to expand S { .. } in patterns #3928

Closed
vlad20012 opened this issue May 31, 2019 · 3 comments
Closed

Add intention to expand S { .. } in patterns #3928

vlad20012 opened this issue May 31, 2019 · 3 comments
Labels
E-easy Issue required minimal knowledge about platform and project codebase feature help wanted

Comments

@vlad20012
Copy link
Member

vlad20012 commented May 31, 2019

In rust it's possible to skip some fields in patterns by adding ..:

struct S { a: i32, b: i32, c:i32 }
fn foo(s: S) {
    let S { a, .. } = s;
}

And for tuple struct case:

struct S(i32, i32, i32);
fn foo(s: S) {
    let S(a, ..) = s;
}

It would be nice to have an intention to replace such .. with the actual fields.

@vlad20012 vlad20012 added help wanted E-easy Issue required minimal knowledge about platform and project codebase feature labels May 31, 2019
@shevtsiv
Copy link
Contributor

If no objection, I would like to work on this issue.

@vlad20012
Copy link
Member Author

Maybe it's reasonable to implement analysis for E0027 & E0023 first

bors bot added a commit that referenced this issue Aug 19, 2019
3996: INT & ANN: Implement intention and fix for struct fields expansion instead of `..` r=vlad20012 a=shevtsiv

<!--
Hello and thank you for the pull request!

We don't have any strict rules about pull requests, but you might check
https://github.com/intellij-rust/intellij-rust/blob/master/CONTRIBUTING.md
for some hints!

Note that we need an electronic CLA for contributions:
https://github.com/intellij-rust/intellij-rust/blob/master/CONTRIBUTING.md#cla

After you sign the CLA, please add your name to
https://github.com/intellij-rust/intellij-rust/blob/master/CONTRIBUTORS.txt

:)
-->
In this pull request I intend to do the following:
1) Create E0023 and E0027 error classes and implement analysis for them.
2) Create fix for those errors.
3) Create intention for struct fields expansion.
4) Create a module with shared code for using it in the fix and intention.

Once these steps are complete I will squash all the commits and #3928 should be closed after merge.

4094: TY&RES: implement hygiene & infer types in macros r=undin a=vlad20012

Now we take into account any custom macros in type inference

Co-authored-by: shevtsiv <rostykshevtsiv@gmail.com>
Co-authored-by: vlad20012 <beskvlad@gmail.com>
bors bot added a commit that referenced this issue Aug 19, 2019
3996: INT & ANN: Implement intention and fix for struct fields expansion instead of `..` r=vlad20012 a=shevtsiv

<!--
Hello and thank you for the pull request!

We don't have any strict rules about pull requests, but you might check
https://github.com/intellij-rust/intellij-rust/blob/master/CONTRIBUTING.md
for some hints!

Note that we need an electronic CLA for contributions:
https://github.com/intellij-rust/intellij-rust/blob/master/CONTRIBUTING.md#cla

After you sign the CLA, please add your name to
https://github.com/intellij-rust/intellij-rust/blob/master/CONTRIBUTORS.txt

:)
-->
In this pull request I intend to do the following:
1) Create E0023 and E0027 error classes and implement analysis for them.
2) Create fix for those errors.
3) Create intention for struct fields expansion.
4) Create a module with shared code for using it in the fix and intention.

Once these steps are complete I will squash all the commits and #3928 should be closed after merge.

Co-authored-by: shevtsiv <rostykshevtsiv@gmail.com>
@Undin
Copy link
Member

Undin commented Sep 1, 2019

Fixed in #3996

@Undin Undin closed this as completed Sep 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Issue required minimal knowledge about platform and project codebase feature help wanted
Projects
None yet
Development

No branches or pull requests

3 participants