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

Can define a associated type more than once #23969

Closed
Kimundi opened this Issue Apr 2, 2015 · 3 comments

Comments

Projects
None yet
7 participants
@Kimundi
Copy link
Member

Kimundi commented Apr 2, 2015

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.

@Kimundi Kimundi added the A-parser label Apr 2, 2015

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Apr 2, 2015

triage: I-nominated

@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Apr 2, 2015

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

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Apr 24, 2015

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

nham pushed a commit to nham/rust that referenced this issue Jun 3, 2015

nham pushed a commit to nham/rust that referenced this issue Jun 3, 2015

nham pushed a commit to nham/rust that referenced this issue Jun 3, 2015

nham pushed a commit to nham/rust that referenced this issue Jun 16, 2015

nham pushed a commit to nham/rust that referenced this issue Jul 15, 2015

Nick Hamann
Better detection of duplicate associated items.
Expands E0201 to be used for any duplicate associated items, not just duplicate
methods/functions. It also correctly detects when two different kinds of items
(like a constant and a method) have the same name.

Fixes rust-lang#23969.

bors added a commit that referenced this issue Jul 16, 2015

Auto merge of #25993 - nham:fix_23969, r=nikomatsakis
Adds two error codes, one for duplicate associated constants and one for types. I'm not certain these should each have their own code, but E0201 is already solely for duplicate associated functions so at least it kinda matches. This will lead to somewhat redundant error explanations, but that's nothing new!

Fixes #23969.

bors added a commit that referenced this issue Jul 17, 2015

Auto merge of #25993 - nham:fix_23969, r=nikomatsakis
Adds two error codes, one for duplicate associated constants and one for types. I'm not certain these should each have their own code, but E0201 is already solely for duplicate associated functions so at least it kinda matches. This will lead to somewhat redundant error explanations, but that's nothing new!

Fixes #23969.

bors added a commit that referenced this issue Jul 17, 2015

Auto merge of #25993 - nham:fix_23969, r=nikomatsakis
Adds two error codes, one for duplicate associated constants and one for types. I'm not certain these should each have their own code, but E0201 is already solely for duplicate associated functions so at least it kinda matches. This will lead to somewhat redundant error explanations, but that's nothing new!

Fixes #23969.

bors added a commit that referenced this issue Jul 17, 2015

Auto merge of #25993 - nham:fix_23969, r=nikomatsakis
Adds two error codes, one for duplicate associated constants and one for types. I'm not certain these should each have their own code, but E0201 is already solely for duplicate associated functions so at least it kinda matches. This will lead to somewhat redundant error explanations, but that's nothing new!

Fixes #23969.

Manishearth added a commit to Manishearth/rust that referenced this issue Jul 17, 2015

Rollup merge of rust-lang#25993 - nham:fix_23969, r=nikomatsakis
Adds two error codes, one for duplicate associated constants and one for types. I'm not certain these should each have their own code, but E0201 is already solely for duplicate associated functions so at least it kinda matches. This will lead to somewhat redundant error explanations, but that's nothing new!

Fixes rust-lang#23969.

bors added a commit that referenced this issue Jul 17, 2015

Auto merge of #25993 - nham:fix_23969, r=nikomatsakis
Adds two error codes, one for duplicate associated constants and one for types. I'm not certain these should each have their own code, but E0201 is already solely for duplicate associated functions so at least it kinda matches. This will lead to somewhat redundant error explanations, but that's nothing new!

Fixes #23969.

bors added a commit that referenced this issue Jul 17, 2015

Auto merge of #25993 - nham:fix_23969, r=nikomatsakis
Adds two error codes, one for duplicate associated constants and one for types. I'm not certain these should each have their own code, but E0201 is already solely for duplicate associated functions so at least it kinda matches. This will lead to somewhat redundant error explanations, but that's nothing new!

Fixes #23969.

@bors bors closed this in #25993 Jul 17, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.