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

Poor error messages from impl EnumValue #19197

Closed
gmorenz opened this issue Nov 21, 2014 · 1 comment · Fixed by #33696
Closed

Poor error messages from impl EnumValue #19197

gmorenz opened this issue Nov 21, 2014 · 1 comment · Fixed by #33696
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@gmorenz
Copy link

gmorenz commented Nov 21, 2014

Compiling

enum E {
    A
}

impl E::A {}

Results in

tmp.rs:5:6: 5:10 error: inherent implementations may only be implemented in the same module as the type they are implemented for
tmp.rs:5 impl E::A {}
              ^~~~
error: aborting due to previous error

Which doesn't seem quite right...

Compiling

trait T {}

enum E {
    A
}

impl T for E::A {}

fn main(){}

Results in

tmp.rs:7:12: 7:16 error: found value name used as a type: DefVariant(DefId { krate: 0, node: 7 }, DefId { krate: 0, node: 8 }, false)
tmp.rs:7 impl T for E::A {}
                    ^~~~

Which, while being correct, is printing out compiler internals for no obvious reason...

@kmcallister kmcallister added the A-diagnostics Area: Messages for errors, warnings, and lints label Nov 23, 2014
@nham
Copy link
Contributor

nham commented May 7, 2015

This is still reproducible. Rust version is:

rustc 1.1.0-nightly (435622028 2015-05-04) (built 2015-05-05)

Code is:

enum E {
    A
}

impl E::A {}

fn main() {}

The result is:

test_19197.rs:5:6: 5:10 error: found value name used as a type: DefVariant(DefId { krate: 0, node: 4 }, DefId { krate: 0, node: 5 }, false) [E0248]
test_19197.rs:5 impl E::A {}
                     ^~~~
error: aborting due to previous error

nham pushed a commit to nham/rust that referenced this issue May 17, 2016
Manishearth added a commit to Manishearth/rust that referenced this issue May 19, 2016
Add regression tests for error message when using enum variant as a type

I'm guessing these were actually fixed with PR rust-lang#27085.

Closes rust-lang#21225
Closes rust-lang#19197
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants