Skip to content

Path to associated type via a struct's type parameter #19558

Closed
@nrc

Description

@nrc
#![feature(associated_types)]

trait Foo {
    type A;
}

struct B<X: Foo<A=int>>{
    x: X::A,
}

fn main() {
    let b = B { x: 42i };
    let _: int = b.x;
}

The struct definition is OK, but the struct initialiser fails to type check (which I think it should). We don't get as far as the second assignment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions