@@ -18,7 +18,7 @@ use std::sync::atomic::Ordering::Relaxed;
1818use super :: query:: DepGraphQuery ;
1919use super :: serialized:: { GraphEncoder , SerializedDepGraph , SerializedDepNodeIndex } ;
2020use super :: { DepContext , DepKind , DepNode , Deps , HasDepContext , WorkProductId } ;
21- use crate :: dep_graph:: EdgesVec ;
21+ use crate :: dep_graph:: edges :: EdgesVec ;
2222use crate :: ich:: StableHashingContext ;
2323use crate :: query:: { QueryContext , QuerySideEffects } ;
2424
@@ -41,8 +41,7 @@ rustc_index::newtype_index! {
4141}
4242
4343impl 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 ) ;
4645 pub const FOREVER_RED_NODE : DepNodeIndex = DepNodeIndex :: from_u32 ( 1 ) ;
4746}
4847
@@ -53,28 +52,28 @@ impl From<DepNodeIndex> for QueryInvocationId {
5352 }
5453}
5554
56- pub struct MarkFrame < ' a > {
55+ pub ( crate ) struct MarkFrame < ' a > {
5756 index : SerializedDepNodeIndex ,
5857 parent : Option < & ' a MarkFrame < ' a > > ,
5958}
6059
6160#[ derive( PartialEq ) ]
62- pub enum DepNodeColor {
61+ enum DepNodeColor {
6362 Red ,
6463 Green ( DepNodeIndex ) ,
6564}
6665
6766impl DepNodeColor {
6867 #[ inline]
69- pub fn is_green ( self ) -> bool {
68+ fn is_green ( self ) -> bool {
7069 match self {
7170 DepNodeColor :: Red => false ,
7271 DepNodeColor :: Green ( _) => true ,
7372 }
7473 }
7574}
7675
77- pub struct DepGraphData < D : Deps > {
76+ pub ( crate ) struct DepGraphData < D : Deps > {
7877 /// The new encoding of the dependency graph, optimized for red/green
7978 /// tracking. The `current` field is the dependency graph of only the
8079 /// current compilation session: We don't merge the previous dep-graph into
@@ -185,7 +184,7 @@ impl<D: Deps> DepGraph<D> {
185184 }
186185
187186 #[ inline]
188- pub fn data ( & self ) -> Option < & DepGraphData < D > > {
187+ pub ( crate ) fn data ( & self ) -> Option < & DepGraphData < D > > {
189188 self . data . as_deref ( )
190189 }
191190
@@ -333,7 +332,7 @@ impl<D: Deps> DepGraphData<D> {
333332 ///
334333 /// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/queries/incremental-compilation.html
335334 #[ 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 > (
337336 & self ,
338337 key : DepNode ,
339338 cx : Ctxt ,
@@ -398,7 +397,7 @@ impl<D: Deps> DepGraphData<D> {
398397
399398 /// Executes something within an "anonymous" task, that is, a task the
400399 /// `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 > (
402401 & self ,
403402 cx : Tcx ,
404403 dep_kind : DepKind ,
@@ -618,7 +617,7 @@ impl<D: Deps> DepGraph<D> {
618617
619618impl < D : Deps > DepGraphData < D > {
620619 #[ 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 > {
622621 if let Some ( prev_index) = self . previous . node_to_index_opt ( dep_node) {
623622 self . current . prev_index_to_index . lock ( ) [ prev_index]
624623 } else {
@@ -627,7 +626,7 @@ impl<D: Deps> DepGraphData<D> {
627626 }
628627
629628 #[ inline]
630- pub fn dep_node_exists ( & self , dep_node : & DepNode ) -> bool {
629+ fn dep_node_exists ( & self , dep_node : & DepNode ) -> bool {
631630 self . dep_node_index_of_opt ( dep_node) . is_some ( )
632631 }
633632
@@ -643,21 +642,21 @@ impl<D: Deps> DepGraphData<D> {
643642 /// Returns true if the given node has been marked as green during the
644643 /// current compilation session. Used in various assertions
645644 #[ inline]
646- pub fn is_index_green ( & self , prev_index : SerializedDepNodeIndex ) -> bool {
645+ pub ( crate ) fn is_index_green ( & self , prev_index : SerializedDepNodeIndex ) -> bool {
647646 self . colors . get ( prev_index) . is_some_and ( |c| c. is_green ( ) )
648647 }
649648
650649 #[ inline]
651- pub fn prev_fingerprint_of ( & self , prev_index : SerializedDepNodeIndex ) -> Fingerprint {
650+ pub ( crate ) fn prev_fingerprint_of ( & self , prev_index : SerializedDepNodeIndex ) -> Fingerprint {
652651 self . previous . fingerprint_by_index ( prev_index)
653652 }
654653
655654 #[ inline]
656- pub fn prev_node_of ( & self , prev_index : SerializedDepNodeIndex ) -> DepNode {
655+ pub ( crate ) fn prev_node_of ( & self , prev_index : SerializedDepNodeIndex ) -> DepNode {
657656 self . previous . index_to_node ( prev_index)
658657 }
659658
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 ) {
661660 self . debug_loaded_from_disk . lock ( ) . insert ( dep_node) ;
662661 }
663662}
@@ -684,8 +683,9 @@ impl<D: Deps> DepGraph<D> {
684683 self . data . as_ref ( ) . unwrap ( ) . debug_loaded_from_disk . lock ( ) . contains ( & dep_node)
685684 }
686685
686+ #[ cfg( debug_assertions) ]
687687 #[ 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 )
689689 where
690690 F : FnOnce ( ) -> String ,
691691 {
@@ -725,7 +725,7 @@ impl<D: Deps> DepGraphData<D> {
725725 /// A node will have an index, when it's already been marked green, or when we can mark it
726726 /// green. This function will mark the current task as a reader of the specified node, when
727727 /// 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 > > (
729729 & self ,
730730 qcx : Qcx ,
731731 dep_node : & DepNode ,
0 commit comments