Skip to content

"associated type T not found for type parameter X" error with where clause #20745

@mandel59

Description

@mandel59
trait A {
    type T;
}

impl A for () {
    type T = i32;
}

fn foo<X>(_x: X::T) where X: A {
}

fn main() {
    foo::<()>(42);
}

This fails to compile with:

assoc.rs:9:15: 9:19 error: associated type `T` not found for type parameter `X`
assoc.rs:9 fn foo<X>(_x: X::T) where X: A {
                         ^~~~
error: aborting due to previous error

It passes with tweaking the definition:

fn foo<X: A>(_x: X::T) {
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions