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

Duplicate predicates cause ambiguities when normalized associated types #21965

Closed
nikomatsakis opened this issue Feb 5, 2015 · 0 comments · Fixed by #21968
Closed

Duplicate predicates cause ambiguities when normalized associated types #21965

nikomatsakis opened this issue Feb 5, 2015 · 0 comments · Fixed by #21968
Labels
A-associated-items Area: Associated items (types, constants & functions)

Comments

@nikomatsakis
Copy link
Contributor

The following example fails to compile:

trait Foo {
    type B;

    fn get() -> Self::B;
}

fn foo<T>() -> ()
    where T : Foo<B=()>, T : Foo<B=()>
{
    <T as Foo>::get()
}

fn main() { }

It yields:

<anon>:10:5: 10:21 error: type annotations required: cannot resolve `<T as Foo>::B == _` [E0284]
<anon>:10     <T as Foo>::get()
              ^~~~~~~~~~~~~~~~
error: aborting due to previous error
playpen: application terminated with error code 101

However, if you comment out the duplicate where clause, it will compile just fine.

@nikomatsakis nikomatsakis added A-associated-items Area: Associated items (types, constants & functions) I-wrong labels Feb 5, 2015
Manishearth added a commit to Manishearth/rust that referenced this issue Feb 6, 2015
…preds-in-env, r=pnkfelix

 We were already building a hashset to check for duplicates, but we assumed that the initial vector had no duplicates. Fixes rust-lang#21965.

r? @pnkfelix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant