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

Better error messages for the nullary-enum-variant-versus-variable binding problem. #7807

Closed
bblum opened this issue Jul 15, 2013 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name/path resolution done by `rustc_resolve` specifically

Comments

@bblum
Copy link
Contributor

bblum commented Jul 15, 2013

The problem is, of course, as follows:

import names::{Alice, Bob};
...
match name {
    Alice => ...,
    Bob   => ...,
    Carol => ..., // <- treated as a variable because of forgotten import
    _     => ..., //~ WARNING unreachable pattern
}

or:

match name {
    Alice => ...,
    Bob | Carol => ..., //~ ERROR variable Carol not bound in all patterns
}

We should be able to emit a hint that says something like Maybe you forgot to import Carol?.

@jdm
Copy link
Contributor

jdm commented Jul 15, 2013

See #4612 and #4639.

@bblum
Copy link
Contributor Author

bblum commented Jul 15, 2013

woops, didn't do my homework before filing a duplicate.

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 A-resolve Area: Name/path resolution done by `rustc_resolve` specifically
Projects
None yet
Development

No branches or pull requests

2 participants