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

Display all witnesses for non-exhaustive patterns #16884

Closed
ghost opened this issue Aug 30, 2014 · 2 comments
Closed

Display all witnesses for non-exhaustive patterns #16884

ghost opened this issue Aug 30, 2014 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@ghost
Copy link

ghost commented Aug 30, 2014

Right now it's only one.

enum Direction {
    North,
    East,
    South,
    West
}

fn reverse(dir: Direction) -> Direction {
    match dir {
        North => South,
        East => West
    }
}

fn main() { }
<anon>:9:5: 12:6 error: non-exhaustive patterns: `South` not covered [E0004]
<anon>:9     match dir {
<anon>:10         North => South,
<anon>:11         East => West
<anon>:12     }
error: aborting due to previous error

Ideally, it'd be with some reasonable limit (10?).

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Jan 27, 2015
@steveklabnik steveklabnik added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Apr 21, 2015
@regexident
Copy link
Contributor

Just pushed a PR for this: #31020

Hope I'm doing this right in regards to the PR workflow?

bors added a commit that referenced this issue Jan 27, 2016
Changes error message from displaying first found missing constructor witness to showing up to 10, if necessary.

Fixes issue #16884.
@jonas-schievink
Copy link
Contributor

This can be closed:

<anon>:11:5: 14:6 error: non-exhaustive patterns: `South` and `West` not covered [E0004]
<anon>:11     match dir {
<anon>:12         North => South,
<anon>:13         East => West
<anon>:14     }
<anon>:11:5: 14:6 help: see the detailed explanation for E0004
error: aborting due to previous error

bors added a commit to rust-lang-ci/rust that referenced this issue Mar 31, 2024
internal: Move grammar codegen into xtask

rust-lang/rust-analyzer#14778, also threw in the one line fix for rust-lang/rust-analyzer#13912
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

3 participants