Skip to content

Poor error messages from impl EnumValue #19197

Closed
@gmorenz

Description

@gmorenz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions