Skip to content

impl Trait for module yields weird error message #8763

Closed

Description

@jdm
mod a {
}

trait A {
}

impl A for a {
}

fn main() {
}
/tmp/foo.rs:7:11: 7:12 error: found value name used as a type: def_mod({crate: 0, node: 1})
/tmp/foo.rs:7 impl A for a {
                         ^

We could do better here.

Activity

  1. added a commit that references this issue on Nov 24, 2013
  2. jfager commented on Feb 1, 2014

    @jfager
    Contributor

    This looks like it can be closed.

  3. JustAPerson commented on Apr 4, 2014

    @JustAPerson
    Contributor

    Perhaps this issue should be closed, as it now gives a much more useful error:

    8763.rs:7:12: 7:13 error: found module name used as a type: mod a::a (id=4)
    8763.rs:7 impl A for a {
                         ^
    
    $ rustc -v
    rustc 0.10-pre (7bda3df 2014-04-02 17:51:48 -0700)
    host: x86_64-unknown-linux-gnu
    
  4. added a commit that references this issue on May 21, 2022
  5. added a commit that references this issue on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions