Skip to content

Conversation

@edwardw
Copy link
Contributor

@edwardw edwardw commented Feb 7, 2015

When projecting associate types for a trait's default methods, the
trait itself was added to the predicate candidate list twice: one from
parameter environment, the other from trait definition. Then the
duplicates were deemed as code ambiguity and the compiler rejected the
code. Simply checking and dropping the duplicates solves the issue.

Closes #22036

@rust-highfive
Copy link
Contributor

r? @pcwalton

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

r? @nikomatsakis or @nick29581

When projecting associate types for a trait's default methods, the
trait itself was added to the predicate candidate list twice: one from
parameter environment, the other from trait definition. Then the
duplicates were deemed as code ambiguity and the compiler rejected the
code. Simply checking and dropping the duplicates solves the issue.

Closes rust-lang#22036
@nikomatsakis
Copy link
Contributor

@edwardw nice, but I think this was basically a dup of #21968

@nikomatsakis
Copy link
Contributor

that is, it has the same effect (and fixes the same issue).

@nikomatsakis
Copy link
Contributor

(So I'm going to close the PR.)

@nikomatsakis
Copy link
Contributor

And I'm not sure why I left that in 3 distinct comments, no.

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

Successfully merging this pull request may close these issues.

Can't write default methods that depend on a bound of an associated type of their traits

5 participants