]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/associated-types-ref-in-struct-literal.rs
Rollup merge of #105976 - jyn514:unused-make-targets, r=Mark-Simulacrum
[rust.git] / src / test / ui / associated-types / associated-types-ref-in-struct-literal.rs
1 // run-pass
2 // Test associated type references in a struct literal. Issue #20535.
3
4
5 pub trait Foo {
6     type Bar;
7
8     fn dummy(&self) { }
9 }
10
11 impl Foo for isize {
12     type Bar = isize;
13 }
14
15 struct Thing<F: Foo> {
16     a: F,
17     b: F::Bar,
18 }
19
20 fn main() {
21     let thing = Thing{a: 1, b: 2};
22     assert_eq!(thing.a + 1, thing.b);
23 }