Skip to content

Permit evaluation of assoc items on Self by avoiding cycle error#74130

Closed
estebank wants to merge 1 commit intorust-lang:masterfrom
estebank:self-param-assoc-item
Closed

Permit evaluation of assoc items on Self by avoiding cycle error#74130
estebank wants to merge 1 commit intorust-lang:masterfrom
estebank:self-param-assoc-item

Conversation

@estebank
Copy link
Contributor

@estebank estebank commented Jul 7, 2020

Skip the recursive evaluation of super-traits that reference associated
types on Self directly (without using a fully-qualified path) in order
to allow its use.

The following code would previously emit a cycle evaluation error and
will now successfuly compile:

trait Bar<T> {
    fn foo() -> T;
}
trait Foo: Bar<Self::Qux> {
    type Qux;
}

The following will also work:

trait Bar<T> {
    fn foo() -> T;
}
trait Baz {
    type Qux;
}
trait Foo: Bar<Self::Qux> + Baz {}

Fix #35237.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-lang Relevant to the language team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trait inheritance gives unexpected compile error when inherited traits use associated types defined in trait

9 participants