]> git.lizzy.rs Git - rust.git/blobdiff - src/test/ui-fulldeps/issue-24972.rs
Rollup merge of #75485 - RalfJung:pin, r=nagisa
[rust.git] / src / test / ui-fulldeps / issue-24972.rs
index 51e134fbf88719be0e656dc9f734118f264c9e95..044a0c5000e31a80308eb120cdf82861e9880742 100644 (file)
@@ -5,11 +5,18 @@
 
 extern crate rustc_serialize;
 
-use rustc_serialize::{Encodable, Decodable};
+use rustc_serialize::{json, Decodable, Encodable};
 use std::fmt::Display;
 
-pub trait Entity : Decodable + Encodable + Sized {
-    type Key: Clone + Decodable + Encodable + ToString + Display + Eq + Ord + Sized;
+pub trait Entity: Decodable<json::Decoder> + for<'a> Encodable<json::Encoder<'a>> + Sized {
+    type Key: Clone
+        + Decodable<json::Decoder>
+        + for<'a> Encodable<json::Encoder<'a>>
+        + ToString
+        + Display
+        + Eq
+        + Ord
+        + Sized;
 
     fn id(&self) -> Self::Key;
 
@@ -20,7 +27,10 @@ pub struct DbRef<E: Entity> {
     pub id: E::Key,
 }
 
-impl<E> DbRef<E> where E: Entity {
+impl<E> DbRef<E>
+where
+    E: Entity,
+{
     fn get(self) -> Option<E> {
         E::find_by_id(self.id)
     }