@@ -9,6 +9,7 @@ use json::{
9
9
from_str, DecodeResult , Decoder , DecoderError , Encoder , EncoderError , Json , JsonEvent , Parser ,
10
10
StackElement ,
11
11
} ;
12
+ use rustc_macros:: { Decodable , Encodable } ;
12
13
use rustc_serialize:: json;
13
14
use rustc_serialize:: { Decodable , Encodable } ;
14
15
@@ -17,7 +18,7 @@ use std::io::prelude::*;
17
18
use std:: string;
18
19
use Animal :: * ;
19
20
20
- #[ derive( RustcDecodable , Eq , PartialEq , Debug ) ]
21
+ #[ derive( Decodable , Eq , PartialEq , Debug ) ]
21
22
struct OptionData {
22
23
opt : Option < usize > ,
23
24
}
@@ -48,20 +49,20 @@ fn test_decode_option_malformed() {
48
49
) ;
49
50
}
50
51
51
- #[ derive( PartialEq , RustcEncodable , RustcDecodable , Debug ) ]
52
+ #[ derive( PartialEq , Encodable , Decodable , Debug ) ]
52
53
enum Animal {
53
54
Dog ,
54
55
Frog ( string:: String , isize ) ,
55
56
}
56
57
57
- #[ derive( PartialEq , RustcEncodable , RustcDecodable , Debug ) ]
58
+ #[ derive( PartialEq , Encodable , Decodable , Debug ) ]
58
59
struct Inner {
59
60
a : ( ) ,
60
61
b : usize ,
61
62
c : Vec < string:: String > ,
62
63
}
63
64
64
- #[ derive( PartialEq , RustcEncodable , RustcDecodable , Debug ) ]
65
+ #[ derive( PartialEq , Encodable , Decodable , Debug ) ]
65
66
struct Outer {
66
67
inner : Vec < Inner > ,
67
68
}
@@ -568,7 +569,7 @@ fn test_decode_struct() {
568
569
) ;
569
570
}
570
571
571
- #[ derive( RustcDecodable ) ]
572
+ #[ derive( Decodable ) ]
572
573
struct FloatStruct {
573
574
f : f64 ,
574
575
a : Vec < f64 > ,
@@ -616,20 +617,20 @@ fn test_multiline_errors() {
616
617
assert_eq ! ( from_str( "{\n \" foo\" :\n \" bar\" " ) , Err ( SyntaxError ( EOFWhileParsingObject , 3 , 8 ) ) ) ;
617
618
}
618
619
619
- #[ derive( RustcDecodable ) ]
620
+ #[ derive( Decodable ) ]
620
621
#[ allow( dead_code) ]
621
622
struct DecodeStruct {
622
623
x : f64 ,
623
624
y : bool ,
624
625
z : string:: String ,
625
626
w : Vec < DecodeStruct > ,
626
627
}
627
- #[ derive( RustcDecodable ) ]
628
+ #[ derive( Decodable ) ]
628
629
enum DecodeEnum {
629
630
A ( f64 ) ,
630
631
B ( string:: String ) ,
631
632
}
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 ) {
633
634
let res: DecodeResult < T > = match from_str ( to_parse) {
634
635
Err ( e) => Err ( ParseError ( e) ) ,
635
636
Ok ( json) => Decodable :: decode ( & mut Decoder :: new ( json) ) ,
@@ -933,7 +934,7 @@ fn test_prettyencoder_indent_level_param() {
933
934
#[ test]
934
935
fn test_hashmap_with_enum_key ( ) {
935
936
use std:: collections:: HashMap ;
936
- #[ derive( RustcEncodable , Eq , Hash , PartialEq , RustcDecodable , Debug ) ]
937
+ #[ derive( Encodable , Eq , Hash , PartialEq , Decodable , Debug ) ]
937
938
enum Enum {
938
939
Foo ,
939
940
#[ allow( dead_code) ]
@@ -1254,7 +1255,7 @@ fn test_to_json() {
1254
1255
#[ test]
1255
1256
fn test_encode_hashmap_with_arbitrary_key ( ) {
1256
1257
use std:: collections:: HashMap ;
1257
- #[ derive( PartialEq , Eq , Hash , RustcEncodable ) ]
1258
+ #[ derive( PartialEq , Eq , Hash , Encodable ) ]
1258
1259
struct ArbitraryType ( usize ) ;
1259
1260
let mut hm: HashMap < ArbitraryType , bool > = HashMap :: new ( ) ;
1260
1261
hm. insert ( ArbitraryType ( 1 ) , true ) ;
0 commit comments