@@ -18,7 +18,7 @@ use std::sync::atomic::Ordering::Relaxed;
18
18
use super :: query:: DepGraphQuery ;
19
19
use super :: serialized:: { GraphEncoder , SerializedDepGraph , SerializedDepNodeIndex } ;
20
20
use super :: { DepContext , DepKind , DepNode , Deps , HasDepContext , WorkProductId } ;
21
- use crate :: dep_graph:: EdgesVec ;
21
+ use crate :: dep_graph:: edges :: EdgesVec ;
22
22
use crate :: ich:: StableHashingContext ;
23
23
use crate :: query:: { QueryContext , QuerySideEffects } ;
24
24
@@ -41,8 +41,7 @@ rustc_index::newtype_index! {
41
41
}
42
42
43
43
impl DepNodeIndex {
44
- pub const INVALID : DepNodeIndex = DepNodeIndex :: MAX ;
45
- pub const SINGLETON_DEPENDENCYLESS_ANON_NODE : DepNodeIndex = DepNodeIndex :: from_u32 ( 0 ) ;
44
+ const SINGLETON_DEPENDENCYLESS_ANON_NODE : DepNodeIndex = DepNodeIndex :: from_u32 ( 0 ) ;
46
45
pub const FOREVER_RED_NODE : DepNodeIndex = DepNodeIndex :: from_u32 ( 1 ) ;
47
46
}
48
47
@@ -53,28 +52,28 @@ impl From<DepNodeIndex> for QueryInvocationId {
53
52
}
54
53
}
55
54
56
- pub struct MarkFrame < ' a > {
55
+ pub ( crate ) struct MarkFrame < ' a > {
57
56
index : SerializedDepNodeIndex ,
58
57
parent : Option < & ' a MarkFrame < ' a > > ,
59
58
}
60
59
61
60
#[ derive( PartialEq ) ]
62
- pub enum DepNodeColor {
61
+ enum DepNodeColor {
63
62
Red ,
64
63
Green ( DepNodeIndex ) ,
65
64
}
66
65
67
66
impl DepNodeColor {
68
67
#[ inline]
69
- pub fn is_green ( self ) -> bool {
68
+ fn is_green ( self ) -> bool {
70
69
match self {
71
70
DepNodeColor :: Red => false ,
72
71
DepNodeColor :: Green ( _) => true ,
73
72
}
74
73
}
75
74
}
76
75
77
- pub struct DepGraphData < D : Deps > {
76
+ pub ( crate ) struct DepGraphData < D : Deps > {
78
77
/// The new encoding of the dependency graph, optimized for red/green
79
78
/// tracking. The `current` field is the dependency graph of only the
80
79
/// current compilation session: We don't merge the previous dep-graph into
@@ -185,7 +184,7 @@ impl<D: Deps> DepGraph<D> {
185
184
}
186
185
187
186
#[ inline]
188
- pub fn data ( & self ) -> Option < & DepGraphData < D > > {
187
+ pub ( crate ) fn data ( & self ) -> Option < & DepGraphData < D > > {
189
188
self . data . as_deref ( )
190
189
}
191
190
@@ -333,7 +332,7 @@ impl<D: Deps> DepGraphData<D> {
333
332
///
334
333
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/queries/incremental-compilation.html
335
334
#[ inline( always) ]
336
- pub fn with_task < Ctxt : HasDepContext < Deps = D > , A : Debug , R > (
335
+ pub ( crate ) fn with_task < Ctxt : HasDepContext < Deps = D > , A : Debug , R > (
337
336
& self ,
338
337
key : DepNode ,
339
338
cx : Ctxt ,
@@ -398,7 +397,7 @@ impl<D: Deps> DepGraphData<D> {
398
397
399
398
/// Executes something within an "anonymous" task, that is, a task the
400
399
/// `DepNode` of which is determined by the list of inputs it read from.
401
- pub fn with_anon_task < Tcx : DepContext < Deps = D > , OP , R > (
400
+ pub ( crate ) fn with_anon_task < Tcx : DepContext < Deps = D > , OP , R > (
402
401
& self ,
403
402
cx : Tcx ,
404
403
dep_kind : DepKind ,
@@ -618,7 +617,7 @@ impl<D: Deps> DepGraph<D> {
618
617
619
618
impl < D : Deps > DepGraphData < D > {
620
619
#[ inline]
621
- pub fn dep_node_index_of_opt ( & self , dep_node : & DepNode ) -> Option < DepNodeIndex > {
620
+ fn dep_node_index_of_opt ( & self , dep_node : & DepNode ) -> Option < DepNodeIndex > {
622
621
if let Some ( prev_index) = self . previous . node_to_index_opt ( dep_node) {
623
622
self . current . prev_index_to_index . lock ( ) [ prev_index]
624
623
} else {
@@ -627,7 +626,7 @@ impl<D: Deps> DepGraphData<D> {
627
626
}
628
627
629
628
#[ inline]
630
- pub fn dep_node_exists ( & self , dep_node : & DepNode ) -> bool {
629
+ fn dep_node_exists ( & self , dep_node : & DepNode ) -> bool {
631
630
self . dep_node_index_of_opt ( dep_node) . is_some ( )
632
631
}
633
632
@@ -643,21 +642,21 @@ impl<D: Deps> DepGraphData<D> {
643
642
/// Returns true if the given node has been marked as green during the
644
643
/// current compilation session. Used in various assertions
645
644
#[ inline]
646
- pub fn is_index_green ( & self , prev_index : SerializedDepNodeIndex ) -> bool {
645
+ pub ( crate ) fn is_index_green ( & self , prev_index : SerializedDepNodeIndex ) -> bool {
647
646
self . colors . get ( prev_index) . is_some_and ( |c| c. is_green ( ) )
648
647
}
649
648
650
649
#[ inline]
651
- pub fn prev_fingerprint_of ( & self , prev_index : SerializedDepNodeIndex ) -> Fingerprint {
650
+ pub ( crate ) fn prev_fingerprint_of ( & self , prev_index : SerializedDepNodeIndex ) -> Fingerprint {
652
651
self . previous . fingerprint_by_index ( prev_index)
653
652
}
654
653
655
654
#[ inline]
656
- pub fn prev_node_of ( & self , prev_index : SerializedDepNodeIndex ) -> DepNode {
655
+ pub ( crate ) fn prev_node_of ( & self , prev_index : SerializedDepNodeIndex ) -> DepNode {
657
656
self . previous . index_to_node ( prev_index)
658
657
}
659
658
660
- pub fn mark_debug_loaded_from_disk ( & self , dep_node : DepNode ) {
659
+ pub ( crate ) fn mark_debug_loaded_from_disk ( & self , dep_node : DepNode ) {
661
660
self . debug_loaded_from_disk . lock ( ) . insert ( dep_node) ;
662
661
}
663
662
}
@@ -684,8 +683,9 @@ impl<D: Deps> DepGraph<D> {
684
683
self . data . as_ref ( ) . unwrap ( ) . debug_loaded_from_disk . lock ( ) . contains ( & dep_node)
685
684
}
686
685
686
+ #[ cfg( debug_assertions) ]
687
687
#[ inline( always) ]
688
- pub fn register_dep_node_debug_str < F > ( & self , dep_node : DepNode , debug_str_gen : F )
688
+ pub ( crate ) fn register_dep_node_debug_str < F > ( & self , dep_node : DepNode , debug_str_gen : F )
689
689
where
690
690
F : FnOnce ( ) -> String ,
691
691
{
@@ -725,7 +725,7 @@ impl<D: Deps> DepGraphData<D> {
725
725
/// A node will have an index, when it's already been marked green, or when we can mark it
726
726
/// green. This function will mark the current task as a reader of the specified node, when
727
727
/// a node index can be found for that node.
728
- pub fn try_mark_green < Qcx : QueryContext < Deps = D > > (
728
+ pub ( crate ) fn try_mark_green < Qcx : QueryContext < Deps = D > > (
729
729
& self ,
730
730
qcx : Qcx ,
731
731
dep_node : & DepNode ,
0 commit comments