@@ -9,7 +9,7 @@ use serde::ser::{self, Serialize};
99use serde:: de:: { self , Deserialize } ;
1010use serde_json;
1111
12- use core:: { Package , TargetKind } ;
12+ use core:: { Epoch , Package , TargetKind } ;
1313use util;
1414use util:: { Fresh , Dirty , Freshness , internal, profile} ;
1515use util:: errors:: { CargoResult , CargoResultExt } ;
@@ -145,6 +145,7 @@ pub struct Fingerprint {
145145 #[ serde( skip_serializing, skip_deserializing) ]
146146 memoized_hash : Mutex < Option < u64 > > ,
147147 rustflags : Vec < String > ,
148+ epoch : Epoch ,
148149}
149150
150151fn serialize_deps < S > ( deps : & [ ( String , Arc < Fingerprint > ) ] , ser : S )
@@ -170,6 +171,7 @@ fn deserialize_deps<'de, D>(d: D) -> Result<Vec<(String, Arc<Fingerprint>)>, D::
170171 features : String :: new ( ) ,
171172 deps : Vec :: new ( ) ,
172173 memoized_hash : Mutex :: new ( Some ( hash) ) ,
174+ epoch : Epoch :: Epoch2015 ,
173175 rustflags : Vec :: new ( ) ,
174176 } ) )
175177 } ) . collect ( ) )
@@ -252,6 +254,9 @@ impl Fingerprint {
252254 if self . local . len ( ) != old. local . len ( ) {
253255 bail ! ( "local lens changed" ) ;
254256 }
257+ if self . epoch != old. epoch {
258+ bail ! ( "epoch changed" )
259+ }
255260 for ( new, old) in self . local . iter ( ) . zip ( & old. local ) {
256261 match ( new, old) {
257262 ( & LocalFingerprint :: Precalculated ( ref a) ,
@@ -315,9 +320,10 @@ impl hash::Hash for Fingerprint {
315320 ref deps,
316321 ref local,
317322 memoized_hash : _,
323+ epoch,
318324 ref rustflags,
319325 } = * self ;
320- ( rustc, features, target, path, profile, local, rustflags) . hash ( h) ;
326+ ( rustc, features, target, path, profile, local, epoch , rustflags) . hash ( h) ;
321327
322328 h. write_usize ( deps. len ( ) ) ;
323329 for & ( ref name, ref fingerprint) in deps {
@@ -416,6 +422,7 @@ fn calculate<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>)
416422 deps : deps,
417423 local : vec ! [ local] ,
418424 memoized_hash : Mutex :: new ( None ) ,
425+ epoch : unit. pkg . manifest ( ) . epoch ( ) ,
419426 rustflags : extra_flags,
420427 } ) ;
421428 cx. fingerprints . insert ( * unit, Arc :: clone ( & fingerprint) ) ;
@@ -468,6 +475,7 @@ pub fn prepare_build_cmd<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>)
468475 deps : Vec :: new ( ) ,
469476 local : local,
470477 memoized_hash : Mutex :: new ( None ) ,
478+ epoch : Epoch :: Epoch2015 ,
471479 rustflags : Vec :: new ( ) ,
472480 } ;
473481 let compare = compare_old_fingerprint ( & loc, & fingerprint) ;
0 commit comments