about summary refs log tree commit diff
path: root/tests/ui/associated-types/associated-type-struct-construction.rs
blob: 422fd5a0c3a9b0c9d48f27ab3bed4972d5b4f3cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Make sure that users can construct structs through associated types
// in both expressions and patterns

#![feature(more_qualified_paths)]

//@ check-pass
fn main() {
    let <Foo as A>::Assoc { br } = <Foo as A>::Assoc { br: 2 };
    assert!(br == 2);
}

struct StructStruct {
    br: i8,
}

struct Foo;

trait A {
    type Assoc;
}

impl A for Foo {
    type Assoc = StructStruct;
}