about summary refs log tree commit diff
path: root/tests/ui/associated-types/associated-types-ref-in-struct-literal.rs
blob: c39e6deaf394324679c0a0fe2aa58f1aa1281de2 (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);
}