summaryrefslogtreecommitdiffstats
path: root/src/test/ui/associated-types/associated-types-ref-in-struct-literal.rs
blob: 4a490ed0387d21d068c9ecb730395d5b60e531cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// run-pass
// Test associated type references in a struct literal. Issue #20535.


pub trait Foo {
    type Bar;

    fn dummy(&self) { }
}

impl Foo for isize {
    type Bar = isize;
}

struct Thing<F: Foo> {
    a: F,
    b: F::Bar,
}

fn main() {
    let thing = Thing{a: 1, b: 2};
    assert_eq!(thing.a + 1, thing.b);
}