summaryrefslogtreecommitdiffstats
path: root/src/test/ui/associated-types/associated-type-struct-construction.rs
blob: f8f8048fb717f3a07eed548cdd5c4487bebff7b5 (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;
}