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

Unclear ambiguity on nested Associated Types #31372

Closed
icorderi opened this issue Feb 2, 2016 · 2 comments
Closed

Unclear ambiguity on nested Associated Types #31372

icorderi opened this issue Feb 2, 2016 · 2 comments
Labels
A-associated-items Area: Associated items (types, constants & functions)

Comments

@icorderi
Copy link
Contributor

icorderi commented Feb 2, 2016

Given the following code:

pub trait Bar { }

pub trait Foo {
    type BarType: Bar;
}

pub trait Houston {
    type FooType: Foo;

    fn we_have_a(&self, problem: &Self::FooType::BarType); // does not compile
}

we get:

src/foo.rs:10:35: 10:57 error: ambiguous associated type; specify the type using the syntax `<<Self as foo::Houston>::FooType as Trait>::BarType` [E0223]
src/foo.rs:10     fn we_have_a(&self, problem: &Self::FooType::BarType);

This works, but it's not clear why the compiler consideres it an ambiguity:

pub trait Houston {
    type FooType: Foo;

    fn works(&self, looks_fishy: &<Self::FooType as Foo>::BarType); // compiles
}
@icorderi icorderi changed the title Unclear unambiguity on nested Associated Types Unclear ambiguity on nested Associated Types Feb 2, 2016
@steveklabnik steveklabnik added the A-associated-items Area: Associated items (types, constants & functions) label Feb 2, 2016
@malbarbo
Copy link
Contributor

@arielb1 Is this limitation difficult to overcome?

@Mark-Simulacrum
Copy link
Member

Closing this in favor of #38078 because it has more discussion.

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

No branches or pull requests

4 participants