]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_serialize/tests/opaque.rs
Rollup merge of #75485 - RalfJung:pin, r=nagisa
[rust.git] / src / librustc_serialize / tests / opaque.rs
index c827391700709dd62cb9c3f8b6a0fd6641c98c51..13b3676a56cd51b40cd0621633a440e886e84b45 100644 (file)
@@ -1,10 +1,11 @@
 #![allow(rustc::internal)]
 
+use rustc_macros::{Decodable, Encodable};
 use rustc_serialize::opaque::{Decoder, Encoder};
 use rustc_serialize::{Decodable, Encodable};
 use std::fmt::Debug;
 
-#[derive(PartialEq, Clone, Debug, RustcEncodable, RustcDecodable)]
+#[derive(PartialEq, Clone, Debug, Encodable, Decodable)]
 struct Struct {
     a: (),
     b: u8,
@@ -27,11 +28,13 @@ struct Struct {
     q: Option<u32>,
 }
 
-fn check_round_trip<T: Encodable + Decodable + PartialEq + Debug>(values: Vec<T>) {
+fn check_round_trip<T: Encodable<Encoder> + for<'a> Decodable<Decoder<'a>> + PartialEq + Debug>(
+    values: Vec<T>,
+) {
     let mut encoder = Encoder::new(Vec::new());
 
     for value in &values {
-        Encodable::encode(&value, &mut encoder).unwrap();
+        Encodable::encode(value, &mut encoder).unwrap();
     }
 
     let data = encoder.into_inner();
@@ -225,7 +228,7 @@ fn test_struct() {
     }]);
 }
 
-#[derive(PartialEq, Clone, Debug, RustcEncodable, RustcDecodable)]
+#[derive(PartialEq, Clone, Debug, Encodable, Decodable)]
 enum Enum {
     Variant1,
     Variant2(usize, f32),