@@ -7,9 +7,10 @@ use rustc_data_structures::sorted_map::SortedMap;
7
7
use rustc_target:: abi:: { HasDataLayout , Size } ;
8
8
9
9
use super :: { alloc_range, AllocError , AllocId , AllocRange , AllocResult , Provenance } ;
10
+ use rustc_serialize:: { Decodable , Decoder , Encodable , Encoder } ;
10
11
11
12
/// Stores the provenance information of pointers stored in memory.
12
- #[ derive( Clone , PartialEq , Eq , PartialOrd , Ord , Hash , Debug , TyEncodable , TyDecodable ) ]
13
+ #[ derive( Clone , PartialEq , Eq , PartialOrd , Ord , Hash , Debug ) ]
13
14
#[ derive( HashStable ) ]
14
15
pub struct ProvenanceMap < Prov = AllocId > {
15
16
/// Provenance in this map applies from the given offset for an entire pointer-size worth of
@@ -21,6 +22,20 @@ pub struct ProvenanceMap<Prov = AllocId> {
21
22
bytes : Option < Box < SortedMap < Size , Prov > > > ,
22
23
}
23
24
25
+ impl < D : Decoder , Prov : Decodable < D > > Decodable < D > for ProvenanceMap < Prov > {
26
+ fn decode ( d : & mut D ) -> Self {
27
+ Self { ptrs : Decodable :: decode ( d) , bytes : None }
28
+ }
29
+ }
30
+
31
+ impl < S : Encoder , Prov : Encodable < S > > Encodable < S > for ProvenanceMap < Prov > {
32
+ fn encode ( & self , s : & mut S ) {
33
+ let Self { ptrs, bytes } = self ;
34
+ debug_assert ! ( bytes. is_none( ) ) ;
35
+ ptrs. encode ( s)
36
+ }
37
+ }
38
+
24
39
impl < Prov > ProvenanceMap < Prov > {
25
40
pub fn new ( ) -> Self {
26
41
ProvenanceMap { ptrs : SortedMap :: new ( ) , bytes : None }
0 commit comments