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