Skip to content

"unable to find implementation of trait" with a combination of a generic trait & a static method #4306

Description

@brendanzab
struct Foo<T>(T);

impl<T> Foo<T> {
    static pure fn foo<U>(theta: U) -> Foo<T> {
        Bar::bar(theta)
    }
}

impl<T> Foo<T>: Bar<T> {
    static pure fn bar<U>(_theta: U) -> Foo<T> { fail(~"") }
}

trait Bar<T> {
    static pure fn bar<U>(theta: U) -> self;
}

fn main() {}
$ rustc cross_mod_traits.rs
test.rs:5:8: 5:16 error: failed to find an implementation of trait @Bar<<V1>> for <V2>
test.rs:5         Bar::bar(theta)

When I remove the type parameters on any of the items it compiles.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions