Skip to content

Can define a associated type more than once #23969

Closed

Description

@Kimundi
trait Foo {
    type Ty;
}

impl Foo for () {
    type Ty = ();
    type Ty = usize;
}

fn main() { 
    let _: <() as Foo>::Ty = ();
}

This erroneously parses and compiles fine, the compiler seems to use the first definition of Ty in the impl.

This might have been introduced by #23265, ping @eddyb.

Activity

  1. added
    A-parserArea: The lexing & parsing of Rust source code to an AST
    on Apr 2, 2015
  2. alexcrichton commented on Apr 2, 2015

    @alexcrichton
    Member

    triage: I-nominated

  3. added
    A-associated-itemsArea: Associated items (types, constants & functions)
    and removed
    A-associated-itemsArea: Associated items (types, constants & functions)
    A-parserArea: The lexing & parsing of Rust source code to an AST
    on Apr 2, 2015
  4. pnkfelix commented on Apr 2, 2015

    @pnkfelix
    Contributor

    classifying as just a bug. P-backcompat-lang, not 1.0 blocker.

  5. brson commented on Apr 24, 2015

    @brson
    Contributor

    Demoting this to P-medium. Somebody should get on it though!

  6. added a commit that references this issue on Jul 15, 2015
    560bb0a
  7. added a commit that references this issue on Jul 17, 2015
    ef9b9ce
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-associated-itemsArea: Associated items (types, constants & functions)A-type-systemArea: Type systemP-mediumMedium priority

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions