@@ -86,24 +86,25 @@ impl fmt::Debug for UnitHash {
8686/// rebuild is needed.
8787#[ derive( Copy , Clone , Debug ) ]
8888pub struct Metadata {
89- meta_hash : UnitHash ,
90- use_extra_filename : bool ,
89+ unit_id : UnitHash ,
90+ c_metadata : UnitHash ,
91+ c_extra_filename : Option < UnitHash > ,
9192}
9293
9394impl Metadata {
9495 /// A hash to identify a given [`Unit`] in the build graph
9596 pub fn unit_id ( & self ) -> UnitHash {
96- self . meta_hash
97+ self . unit_id
9798 }
9899
99100 /// A hash to add to symbol naming through `-C metadata`
100101 pub fn c_metadata ( & self ) -> UnitHash {
101- self . meta_hash
102+ self . c_metadata
102103 }
103104
104105 /// A hash to add to file names through `-C extra-filename`
105106 pub fn c_extra_filename ( & self ) -> Option < UnitHash > {
106- self . use_extra_filename . then_some ( self . meta_hash )
107+ self . c_extra_filename
107108 }
108109}
109110
@@ -678,19 +679,34 @@ fn compute_metadata(
678679 target_configs_are_different. hash ( & mut shared_hasher) ;
679680 }
680681
682+ let mut c_metadata_hasher = shared_hasher. clone ( ) ;
681683 // Mix in the target-metadata of all the dependencies of this target.
682- let mut dep_hashes = deps_metadata
684+ let mut dep_c_metadata_hashes = deps_metadata
683685 . iter ( )
684- . map ( |m| m. meta_hash )
686+ . map ( |m| m. c_metadata )
685687 . collect :: < Vec < _ > > ( ) ;
686- dep_hashes . sort ( ) ;
687- dep_hashes . hash ( & mut shared_hasher ) ;
688+ dep_c_metadata_hashes . sort ( ) ;
689+ dep_c_metadata_hashes . hash ( & mut c_metadata_hasher ) ;
688690
689- let meta_hash = UnitHash ( shared_hasher. finish ( ) ) ;
691+ let mut c_extra_filename_hasher = shared_hasher. clone ( ) ;
692+ // Mix in the target-metadata of all the dependencies of this target.
693+ let mut dep_c_extra_filename_hashes = deps_metadata
694+ . iter ( )
695+ . map ( |m| m. c_extra_filename )
696+ . collect :: < Vec < _ > > ( ) ;
697+ dep_c_extra_filename_hashes. sort ( ) ;
698+ dep_c_extra_filename_hashes. hash ( & mut c_extra_filename_hasher) ;
699+
700+ let c_metadata = UnitHash ( c_metadata_hasher. finish ( ) ) ;
701+ let c_extra_filename = UnitHash ( c_extra_filename_hasher. finish ( ) ) ;
702+ let unit_id = c_extra_filename;
703+
704+ let c_extra_filename = use_extra_filename. then_some ( c_extra_filename) ;
690705
691706 Metadata {
692- meta_hash,
693- use_extra_filename,
707+ unit_id,
708+ c_metadata,
709+ c_extra_filename,
694710 }
695711}
696712
0 commit comments