]> git.lizzy.rs Git - rust.git/blob - src/test/ui-fulldeps/issue-24972.rs
Update dependencies
[rust.git] / src / test / ui-fulldeps / issue-24972.rs
1 // run-pass
2
3 #![allow(dead_code)]
4 #![feature(rustc_private)]
5
6 extern crate serialize;
7
8 use serialize::{Encodable, Decodable};
9 use std::fmt::Display;
10
11 pub trait Entity : Decodable + Encodable + Sized {
12     type Key: Clone + Decodable + Encodable + ToString + Display + Eq + Ord + Sized;
13
14     fn id(&self) -> Self::Key;
15
16     fn find_by_id(id: Self::Key) -> Option<Self>;
17 }
18
19 pub struct DbRef<E: Entity> {
20     pub id: E::Key,
21 }
22
23 impl<E> DbRef<E> where E: Entity {
24     fn get(self) -> Option<E> {
25         E::find_by_id(self.id)
26     }
27 }
28
29 fn main() {}