@@ -9,6 +9,7 @@ use json::{
99 from_str, DecodeResult , Decoder , DecoderError , Encoder , EncoderError , Json , JsonEvent , Parser ,
1010 StackElement ,
1111} ;
12+ use rustc_macros:: { Decodable , Encodable } ;
1213use rustc_serialize:: json;
1314use rustc_serialize:: { Decodable , Encodable } ;
1415
@@ -17,7 +18,7 @@ use std::io::prelude::*;
1718use std:: string;
1819use Animal :: * ;
1920
20- #[ derive( RustcDecodable , Eq , PartialEq , Debug ) ]
21+ #[ derive( Decodable , Eq , PartialEq , Debug ) ]
2122struct OptionData {
2223 opt : Option < usize > ,
2324}
@@ -48,20 +49,20 @@ fn test_decode_option_malformed() {
4849 ) ;
4950}
5051
51- #[ derive( PartialEq , RustcEncodable , RustcDecodable , Debug ) ]
52+ #[ derive( PartialEq , Encodable , Decodable , Debug ) ]
5253enum Animal {
5354 Dog ,
5455 Frog ( string:: String , isize ) ,
5556}
5657
57- #[ derive( PartialEq , RustcEncodable , RustcDecodable , Debug ) ]
58+ #[ derive( PartialEq , Encodable , Decodable , Debug ) ]
5859struct Inner {
5960 a : ( ) ,
6061 b : usize ,
6162 c : Vec < string:: String > ,
6263}
6364
64- #[ derive( PartialEq , RustcEncodable , RustcDecodable , Debug ) ]
65+ #[ derive( PartialEq , Encodable , Decodable , Debug ) ]
6566struct Outer {
6667 inner : Vec < Inner > ,
6768}
@@ -568,7 +569,7 @@ fn test_decode_struct() {
568569 ) ;
569570}
570571
571- #[ derive( RustcDecodable ) ]
572+ #[ derive( Decodable ) ]
572573struct FloatStruct {
573574 f : f64 ,
574575 a : Vec < f64 > ,
@@ -616,20 +617,20 @@ fn test_multiline_errors() {
616617 assert_eq ! ( from_str( "{\n \" foo\" :\n \" bar\" " ) , Err ( SyntaxError ( EOFWhileParsingObject , 3 , 8 ) ) ) ;
617618}
618619
619- #[ derive( RustcDecodable ) ]
620+ #[ derive( Decodable ) ]
620621#[ allow( dead_code) ]
621622struct DecodeStruct {
622623 x : f64 ,
623624 y : bool ,
624625 z : string:: String ,
625626 w : Vec < DecodeStruct > ,
626627}
627- #[ derive( RustcDecodable ) ]
628+ #[ derive( Decodable ) ]
628629enum DecodeEnum {
629630 A ( f64 ) ,
630631 B ( string:: String ) ,
631632}
632- fn check_err < T : Decodable > ( to_parse : & ' static str , expected : DecoderError ) {
633+ fn check_err < T : Decodable < Decoder > > ( to_parse : & ' static str , expected : DecoderError ) {
633634 let res: DecodeResult < T > = match from_str ( to_parse) {
634635 Err ( e) => Err ( ParseError ( e) ) ,
635636 Ok ( json) => Decodable :: decode ( & mut Decoder :: new ( json) ) ,
@@ -933,7 +934,7 @@ fn test_prettyencoder_indent_level_param() {
933934#[ test]
934935fn test_hashmap_with_enum_key ( ) {
935936 use std:: collections:: HashMap ;
936- #[ derive( RustcEncodable , Eq , Hash , PartialEq , RustcDecodable , Debug ) ]
937+ #[ derive( Encodable , Eq , Hash , PartialEq , Decodable , Debug ) ]
937938 enum Enum {
938939 Foo ,
939940 #[ allow( dead_code) ]
@@ -1254,7 +1255,7 @@ fn test_to_json() {
12541255#[ test]
12551256fn test_encode_hashmap_with_arbitrary_key ( ) {
12561257 use std:: collections:: HashMap ;
1257- #[ derive( PartialEq , Eq , Hash , RustcEncodable ) ]
1258+ #[ derive( PartialEq , Eq , Hash , Encodable ) ]
12581259 struct ArbitraryType ( usize ) ;
12591260 let mut hm: HashMap < ArbitraryType , bool > = HashMap :: new ( ) ;
12601261 hm. insert ( ArbitraryType ( 1 ) , true ) ;
0 commit comments