Skip to content

Impls for a generic type with different type parameters conflict with each other. #20188

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

Closed
vadimcn opened this issue Dec 24, 2014 · 1 comment

Comments

@vadimcn
Copy link
Contributor

vadimcn commented Dec 24, 2014

struct Foo<T>(T);
struct A;
struct B;

impl Foo<A> {
    fn foo() {}
}
impl Foo<B> {
    fn foo() {}
}

fn main() {}

produces duplicate definition error for foo:

test.rs:9:2: 9:13 error: duplicate definition of value `foo`
test.rs:9       fn foo() {}
                ^~~~~~~~~~~
test.rs:6:2: 6:13 note: first definition of value `foo` here
test.rs:6       fn foo() {}
                ^~~~~~~~~~~
error: aborting due to previous error

Since Foo<A> and Foo<B> are different types, it seems that their impls should not be interfering with each other.

@japaric
Copy link
Member

japaric commented Dec 24, 2014

Duplicate of #19097

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants