@@ -13,7 +13,7 @@ use rustc_hir::def_id::{
1313} ;
1414use rustc_hir:: definitions:: { DefKey , DefPath , DefPathHash , Definitions } ;
1515use rustc_macros:: { BlobDecodable , Decodable , Encodable , StableHash } ;
16- use rustc_span:: { Span , Symbol } ;
16+ use rustc_span:: { Span , SpanDecoder , SpanEncoder , Symbol } ;
1717
1818// lonely orphan structs and enums looking for a better home
1919
@@ -64,18 +64,44 @@ pub enum LinkagePreference {
6464 RequireStatic ,
6565}
6666
67- #[ derive( Debug , Encodable , Decodable , StableHash ) ]
67+ #[ derive( Debug , StableHash ) ]
6868pub struct NativeLib {
6969 pub kind : NativeLibKind ,
7070 pub name : Symbol ,
7171 /// If packed_bundled_libs enabled, actual filename of library is stored.
72+ #[ stable_hash( ignore) ]
7273 pub filename : Option < Symbol > ,
7374 pub cfg : Option < CfgEntry > ,
7475 pub foreign_module : Option < DefId > ,
7576 pub verbatim : Option < bool > ,
7677 pub dll_imports : Vec < DllImport > ,
7778}
7879
80+ impl < E : SpanEncoder > rustc_serialize:: Encodable < E > for NativeLib {
81+ fn encode ( & self , s : & mut E ) {
82+ self . kind . encode ( s) ;
83+ self . name . encode ( s) ;
84+ self . cfg . encode ( s) ;
85+ self . foreign_module . encode ( s) ;
86+ self . verbatim . encode ( s) ;
87+ self . dll_imports . encode ( s) ;
88+ }
89+ }
90+
91+ impl < D : SpanDecoder > rustc_serialize:: Decodable < D > for NativeLib {
92+ fn decode ( d : & mut D ) -> Self {
93+ NativeLib {
94+ kind : rustc_serialize:: Decodable :: decode ( d) ,
95+ name : rustc_serialize:: Decodable :: decode ( d) ,
96+ filename : None ,
97+ cfg : rustc_serialize:: Decodable :: decode ( d) ,
98+ foreign_module : rustc_serialize:: Decodable :: decode ( d) ,
99+ verbatim : rustc_serialize:: Decodable :: decode ( d) ,
100+ dll_imports : rustc_serialize:: Decodable :: decode ( d) ,
101+ }
102+ }
103+ }
104+
79105impl NativeLib {
80106 pub fn has_modifiers ( & self ) -> bool {
81107 self . verbatim . is_some ( ) || self . kind . has_modifiers ( )
0 commit comments