Skip to content

Commit 5196547

Browse files
incr.comp.: Add some comments.
1 parent a795103 commit 5196547

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

src/librustc/hir/map/collector.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ pub(super) struct NodeCollector<'a, 'hir> {
2828
/// The parent of this node
2929
parent_node: NodeId,
3030

31+
// These fields keep track of the currently relevant DepNodes during
32+
// the visitor's traversal.
3133
current_dep_node_owner: DefIndex,
3234
current_signature_dep_index: DepNodeIndex,
3335
current_full_dep_index: DepNodeIndex,
@@ -38,6 +40,8 @@ pub(super) struct NodeCollector<'a, 'hir> {
3840

3941
hcx: StableHashingContext<'a>,
4042

43+
// We are collecting DepNode::HirBody hashes here so we can compute the
44+
// crate hash from then later on.
4145
hir_body_nodes: Vec<DefPathHash>,
4246
}
4347

@@ -463,11 +467,14 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
463467
}
464468
}
465469

466-
470+
// We use this with DepGraph::with_task(). Since we are handling only input
471+
// values here, the "task" computing them just passes them through.
467472
fn identity_fn<T>(_: &StableHashingContext, item_like: T) -> T {
468473
item_like
469474
}
470475

476+
// This is a wrapper structure that allows determining if span values within
477+
// the wrapped item should be hashed or not.
471478
struct HirItemLike<T> {
472479
item_like: T,
473480
hash_bodies: bool,

src/librustc/ty/context.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
12361236
self.cstore)
12371237
}
12381238

1239+
// This method exercises the `in_scope_traits_map` query for all possible
1240+
// values so that we have their fingerprints available in the DepGraph.
1241+
// This is only required as long as we still use the old dependency tracking
1242+
// which needs to have the fingerprints of all input nodes beforehand.
12391243
pub fn precompute_in_scope_traits_hashes(self) {
12401244
for &def_index in self.trait_map.keys() {
12411245
self.in_scope_traits_map(def_index);

src/librustc_data_structures/stable_hasher.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -558,10 +558,12 @@ pub fn hash_stable_hashmap<HCX, K, V, R, SK, F, W>(
558558
entries.hash_stable(hcx, hasher);
559559
}
560560

561+
562+
/// A vector container that makes sure that its items are hashed in a stable
563+
/// order.
561564
pub struct StableVec<T>(Vec<T>);
562565

563566
impl<T> StableVec<T> {
564-
565567
pub fn new(v: Vec<T>) -> Self {
566568
StableVec(v)
567569
}

src/librustc_driver/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fn test_env<F>(source_string: &str,
133133

134134
let arena = DroplessArena::new();
135135
let arenas = ty::GlobalArenas::new();
136-
let hir_map = hir_map::map_crate(&mut hir_forest, &defs);
136+
let hir_map = hir_map::map_crate(&sess, &*cstore, &mut hir_forest, &defs);
137137

138138
// run just enough stuff to build a tcx:
139139
let named_region_map = resolve_lifetime::krate(&sess, &*cstore, &hir_map);

0 commit comments

Comments
 (0)