]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/associated-types-simple.rs
Rollup merge of #76468 - SNCPlay42:lifetime-names, r=Mark-Simulacrum
[rust.git] / src / test / ui / associated-types / associated-types-simple.rs
1 // run-pass
2
3 trait Get {
4     type Value;
5     fn get(&self) -> &<Self as Get>::Value;
6 }
7
8 struct Struct {
9     x: isize,
10 }
11
12 impl Get for Struct {
13     type Value = isize;
14     fn get(&self) -> &isize {
15         &self.x
16     }
17 }
18
19 fn main() {
20     let s = Struct {
21         x: 100,
22     };
23     assert_eq!(*s.get(), 100);
24 }