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

Type error pretty printer shows something strange #4286

Closed
ice1000 opened this issue Aug 20, 2019 · 4 comments · Fixed by #4290
Closed

Type error pretty printer shows something strange #4286

ice1000 opened this issue Aug 20, 2019 · 4 comments · Fixed by #4290
Assignees
Labels
bug subsystem::code insight General label for issues related to code understanding: highlighting, completion, annotation, etc.

Comments

@ice1000
Copy link
Contributor

ice1000 commented Aug 20, 2019

Environment

  • IntelliJ Rust plugin version: 0.2.104.2714-192-nightly

Problem description

I have a pattern match like this, and intellij-rust gives me a strange message:
image

It shouldn't be Option>. The declaration is like this:
image

And now I've found a minimum-reproducible example:
image

Code for copy-pasting:

enum A {
    B(Option<Box<A>>),
}

fn main() {
    let a = A::B(None);
    match a {
        A::B(_) => unimplemented!(),
    }
}
@ice1000 ice1000 changed the title Type error pretty printer issue Type error pretty printer shows something strange Aug 20, 2019
@ice1000
Copy link
Contributor Author

ice1000 commented Aug 20, 2019

Also, why am I having an error here? My pattern matchings are perfectly correct.

@ice1000
Copy link
Contributor Author

ice1000 commented Aug 20, 2019

Actually, once _ pattern is used, the pattern checker will complain.

@ice1000
Copy link
Contributor Author

ice1000 commented Aug 20, 2019

This is related to #3996

@mchernyavsky mchernyavsky added bug subsystem::code insight General label for issues related to code understanding: highlighting, completion, annotation, etc. labels Aug 20, 2019
@ice1000
Copy link
Contributor Author

ice1000 commented Aug 20, 2019

I have taken a look at the PR. I guess the cause is that patFieldList does not return _ patterns

#3996 (comment)

bors bot added a commit that referenced this issue Aug 21, 2019
4290: Fix declaration fields escaping and underscores in struct patterns r=vlad20012 a=shevtsiv

Closes #4286.

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

:)
-->


Co-authored-by: shevtsiv <rostykshevtsiv@gmail.com>
@bors bors bot closed this as completed in dcb9d71 Aug 21, 2019
mchernyavsky pushed a commit that referenced this issue Aug 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug subsystem::code insight General label for issues related to code understanding: highlighting, completion, annotation, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants