]> git.proxmox.com Git - rustc.git/blame - src/test/ui/associated-types/associated-types-in-inherent-method.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / associated-types / associated-types-in-inherent-method.rs
CommitLineData
b7449926 1// run-pass
c34b1796 2
1a4d82fc
JJ
3trait Get {
4 type Value;
5 fn get(&self) -> &<Self as Get>::Value;
223e47cc
LB
6}
7
1a4d82fc 8struct Struct {
c34b1796 9 x: isize,
223e47cc
LB
10}
11
1a4d82fc 12impl Get for Struct {
c34b1796
AL
13 type Value = isize;
14 fn get(&self) -> &isize {
1a4d82fc 15 &self.x
223e47cc
LB
16 }
17}
18
1a4d82fc
JJ
19impl Struct {
20 fn grab<T:Get>(x: &T) -> &<T as Get>::Value {
21 x.get()
22 }
23}
223e47cc
LB
24
25fn main() {
1a4d82fc
JJ
26 let s = Struct {
27 x: 100,
28 };
29 assert_eq!(*Struct::grab(&s), 100);
223e47cc 30}