@@ -86,24 +86,25 @@ impl fmt::Debug for UnitHash {
86
86
/// rebuild is needed.
87
87
#[ derive( Copy , Clone , Debug ) ]
88
88
pub 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 > ,
91
92
}
92
93
93
94
impl Metadata {
94
95
/// A hash to identify a given [`Unit`] in the build graph
95
96
pub fn unit_id ( & self ) -> UnitHash {
96
- self . meta_hash
97
+ self . unit_id
97
98
}
98
99
99
100
/// A hash to add to symbol naming through `-C metadata`
100
101
pub fn c_metadata ( & self ) -> UnitHash {
101
- self . meta_hash
102
+ self . c_metadata
102
103
}
103
104
104
105
/// A hash to add to file names through `-C extra-filename`
105
106
pub fn c_extra_filename ( & self ) -> Option < UnitHash > {
106
- self . use_extra_filename . then_some ( self . meta_hash )
107
+ self . c_extra_filename
107
108
}
108
109
}
109
110
@@ -678,19 +679,34 @@ fn compute_metadata(
678
679
target_configs_are_different. hash ( & mut shared_hasher) ;
679
680
}
680
681
682
+ let mut c_metadata_hasher = shared_hasher. clone ( ) ;
681
683
// 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
683
685
. iter ( )
684
- . map ( |m| m. meta_hash )
686
+ . map ( |m| m. c_metadata )
685
687
. 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 ) ;
688
690
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) ;
690
705
691
706
Metadata {
692
- meta_hash,
693
- use_extra_filename,
707
+ unit_id,
708
+ c_metadata,
709
+ c_extra_filename,
694
710
}
695
711
}
696
712
0 commit comments