@@ -113,10 +113,28 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
113
113
// TODO -- this could be more efficient if we integrated the `DefIdDirectory` and
114
114
// pred set more deeply
115
115
116
- // Compute the set of Hir nodes whose data has changed or which have been removed.
116
+ // Compute the set of Hir nodes whose data has changed or which
117
+ // have been removed. These are "raw" source nodes, which means
118
+ // that they still use the original `DefPathIndex` values from the
119
+ // encoding, rather than having been retraced to a `DefId`. The
120
+ // reason for this is that this way we can include nodes that have
121
+ // been removed (which no longer have a `DefId` in the current
122
+ // compilation).
117
123
let dirty_raw_source_nodes = dirty_nodes ( tcx, & serialized_dep_graph. hashes , & retraced) ;
118
124
119
- // Create a (maybe smaller) list of
125
+ // Create a list of (raw-source-node ->
126
+ // retracted-target-node) edges. In the process of retracing the
127
+ // target nodes, we may discover some of them def-paths no longer exist,
128
+ // in which case there is no need to mark the corresopnding nodes as dirty
129
+ // (they are just not present). So this list may be smaller than the original.
130
+ //
131
+ // Note though that in the common case the target nodes are
132
+ // `DepNode::WorkProduct` instances, and those don't have a
133
+ // def-id, so they will never be considered to not exist. Instead,
134
+ // we do a secondary hashing step (later, in trans) when we know
135
+ // the set of symbols that go into a work-product: if any symbols
136
+ // have been removed (or added) the hash will be different and
137
+ // we'll ignore the work-product then.
120
138
let retraced_edges: Vec < _ > =
121
139
serialized_dep_graph. edges . iter ( )
122
140
. filter_map ( |& ( ref raw_source_node, ref raw_target_node) | {
@@ -125,7 +143,8 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
125
143
} )
126
144
. collect ( ) ;
127
145
128
- // Compute which work-products have changed.
146
+ // Compute which work-products have an input that has changed or
147
+ // been removed. Put the dirty ones into a set.
129
148
let mut dirty_target_nodes = FnvHashSet ( ) ;
130
149
for & ( raw_source_node, ref target_node) in & retraced_edges {
131
150
if dirty_raw_source_nodes. contains ( raw_source_node) {
0 commit comments