Skip to content

Duplicate predicates cause ambiguities when normalized associated types #21965

Closed
@nikomatsakis

Description

@nikomatsakis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions