Skip to content

Conversation

@matklad
Copy link
Contributor

@matklad matklad commented Apr 29, 2020

We probably should actually use the same machinery here, as we do
for fill match arms, but just special-casing options and results seems
to be a good first step.

bors r+
🤖

matklad added 2 commits April 29, 2020 10:38
We *probably* should actually use the same machinery here, as we do
for fill match arms, but just special-casing options and results seems
to be a good first step.
@bors
Copy link
Contributor

bors bot commented Apr 29, 2020

@bors bors bot merged commit c3dfeba into rust-lang:master Apr 29, 2020
let pattern = sema
.type_of_pat(&pat)
.and_then(|ty| TryEnum::from_ty(sema, &ty))
.map(|it| it.sad_pattern())
Copy link
Member

Choose a reason for hiding this comment

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

what if I wrote if let None = something() {} else {}?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

    match None {
        None => 2,
        None => 1,
    };

😭

I guess that's the case where it becomes easier to do this properly (via exhaustiveness analysis) rather than via heuristics....

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.

2 participants