@@ -26,8 +26,8 @@ use crate::query::{QueryContext, QuerySideEffects};
26
26
use { super :: debug:: EdgeFilter , std:: env} ;
27
27
28
28
#[ derive( Clone ) ]
29
- pub struct DepGraph < D : Deps > {
30
- data : Option < Lrc < DepGraphData < D > > > ,
29
+ pub struct DepGraph {
30
+ data : Option < Lrc < DepGraphData > > ,
31
31
32
32
/// This field is used for assigning DepNodeIndices when running in
33
33
/// non-incremental mode. Even in non-incremental mode we make sure that
@@ -73,12 +73,12 @@ impl DepNodeColor {
73
73
}
74
74
}
75
75
76
- pub ( crate ) struct DepGraphData < D : Deps > {
76
+ pub ( crate ) struct DepGraphData {
77
77
/// The new encoding of the dependency graph, optimized for red/green
78
78
/// tracking. The `current` field is the dependency graph of only the
79
79
/// current compilation session: We don't merge the previous dep-graph into
80
80
/// current one anymore, but we do reference shared data to save space.
81
- current : CurrentDepGraph < D > ,
81
+ current : CurrentDepGraph ,
82
82
83
83
/// The dep-graph from the previous compilation session. It contains all
84
84
/// nodes and edges as well as all fingerprints of nodes that have them.
@@ -111,18 +111,18 @@ where
111
111
stable_hasher. finish ( )
112
112
}
113
113
114
- impl < D : Deps > DepGraph < D > {
115
- pub fn new (
114
+ impl DepGraph {
115
+ pub fn new < D : Deps > (
116
116
profiler : & SelfProfilerRef ,
117
117
prev_graph : SerializedDepGraph ,
118
118
prev_work_products : WorkProductMap ,
119
119
encoder : FileEncoder ,
120
120
record_graph : bool ,
121
121
record_stats : bool ,
122
- ) -> DepGraph < D > {
122
+ ) -> DepGraph {
123
123
let prev_graph_node_count = prev_graph. node_count ( ) ;
124
124
125
- let current = CurrentDepGraph :: new (
125
+ let current = CurrentDepGraph :: new :: < D > (
126
126
profiler,
127
127
prev_graph_node_count,
128
128
encoder,
@@ -179,12 +179,12 @@ impl<D: Deps> DepGraph<D> {
179
179
}
180
180
}
181
181
182
- pub fn new_disabled ( ) -> DepGraph < D > {
182
+ pub fn new_disabled ( ) -> DepGraph {
183
183
DepGraph { data : None , virtual_dep_node_index : Lrc :: new ( AtomicU32 :: new ( 0 ) ) }
184
184
}
185
185
186
186
#[ inline]
187
- pub ( crate ) fn data ( & self ) -> Option < & DepGraphData < D > > {
187
+ pub ( crate ) fn data ( & self ) -> Option < & DepGraphData > {
188
188
self . data . as_deref ( )
189
189
}
190
190
@@ -273,7 +273,7 @@ impl<D: Deps> DepGraph<D> {
273
273
}
274
274
275
275
#[ inline( always) ]
276
- pub fn with_task < Ctxt : HasDepContext < Deps = D > , A : Debug , R > (
276
+ pub fn with_task < Ctxt : HasDepContext , A : Debug , R > (
277
277
& self ,
278
278
key : DepNode ,
279
279
cx : Ctxt ,
@@ -287,7 +287,7 @@ impl<D: Deps> DepGraph<D> {
287
287
}
288
288
}
289
289
290
- pub fn with_anon_task < Tcx : DepContext < Deps = D > , OP , R > (
290
+ pub fn with_anon_task < Tcx : DepContext , OP , R > (
291
291
& self ,
292
292
cx : Tcx ,
293
293
dep_kind : DepKind ,
@@ -303,7 +303,7 @@ impl<D: Deps> DepGraph<D> {
303
303
}
304
304
}
305
305
306
- impl < D : Deps > DepGraphData < D > {
306
+ impl DepGraphData {
307
307
/// Starts a new dep-graph task. Dep-graph tasks are specified
308
308
/// using a free function (`task`) and **not** a closure -- this
309
309
/// is intentional because we want to exercise tight control over
@@ -332,7 +332,7 @@ impl<D: Deps> DepGraphData<D> {
332
332
///
333
333
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/queries/incremental-compilation.html
334
334
#[ inline( always) ]
335
- pub ( crate ) fn with_task < Ctxt : HasDepContext < Deps = D > , A : Debug , R > (
335
+ pub ( crate ) fn with_task < Ctxt : HasDepContext , A : Debug , R > (
336
336
& self ,
337
337
key : DepNode ,
338
338
cx : Ctxt ,
@@ -397,7 +397,7 @@ impl<D: Deps> DepGraphData<D> {
397
397
398
398
/// Executes something within an "anonymous" task, that is, a task the
399
399
/// `DepNode` of which is determined by the list of inputs it read from.
400
- pub ( crate ) fn with_anon_task < Tcx : DepContext < Deps = D > , OP , R > (
400
+ pub ( crate ) fn with_anon_task < Tcx : DepContext , OP , R > (
401
401
& self ,
402
402
cx : Tcx ,
403
403
dep_kind : DepKind ,
@@ -456,7 +456,7 @@ impl<D: Deps> DepGraphData<D> {
456
456
}
457
457
}
458
458
459
- impl < D : Deps > DepGraph < D > {
459
+ impl DepGraph {
460
460
#[ inline]
461
461
pub fn read_index ( & self , dep_node_index : DepNodeIndex ) {
462
462
if let Some ( ref data) = self . data {
@@ -527,7 +527,7 @@ impl<D: Deps> DepGraph<D> {
527
527
/// FIXME: If the code is changed enough for this node to be marked before requiring the
528
528
/// caller's node, we suppose that those changes will be enough to mark this node red and
529
529
/// force a recomputation using the "normal" way.
530
- pub fn with_feed_task < Ctxt : DepContext < Deps = D > , A : Debug , R : Debug > (
530
+ pub fn with_feed_task < Ctxt : DepContext , A : Debug , R : Debug > (
531
531
& self ,
532
532
node : DepNode ,
533
533
cx : Ctxt ,
@@ -615,7 +615,7 @@ impl<D: Deps> DepGraph<D> {
615
615
}
616
616
}
617
617
618
- impl < D : Deps > DepGraphData < D > {
618
+ impl DepGraphData {
619
619
#[ inline]
620
620
fn dep_node_index_of_opt ( & self , dep_node : & DepNode ) -> Option < DepNodeIndex > {
621
621
if let Some ( prev_index) = self . previous . node_to_index_opt ( dep_node) {
@@ -661,7 +661,7 @@ impl<D: Deps> DepGraphData<D> {
661
661
}
662
662
}
663
663
664
- impl < D : Deps > DepGraph < D > {
664
+ impl DepGraph {
665
665
#[ inline]
666
666
pub fn dep_node_exists ( & self , dep_node : & DepNode ) -> bool {
667
667
self . data . as_ref ( ) . is_some_and ( |data| data. dep_node_exists ( dep_node) )
@@ -710,7 +710,7 @@ impl<D: Deps> DepGraph<D> {
710
710
None
711
711
}
712
712
713
- pub fn try_mark_green < Qcx : QueryContext < Deps = D > > (
713
+ pub fn try_mark_green < Qcx : QueryContext > (
714
714
& self ,
715
715
qcx : Qcx ,
716
716
dep_node : & DepNode ,
@@ -719,13 +719,13 @@ impl<D: Deps> DepGraph<D> {
719
719
}
720
720
}
721
721
722
- impl < D : Deps > DepGraphData < D > {
722
+ impl DepGraphData {
723
723
/// Try to mark a node index for the node dep_node.
724
724
///
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 ( crate ) fn try_mark_green < Qcx : QueryContext < Deps = D > > (
728
+ pub ( crate ) fn try_mark_green < Qcx : QueryContext > (
729
729
& self ,
730
730
qcx : Qcx ,
731
731
dep_node : & DepNode ,
@@ -750,7 +750,7 @@ impl<D: Deps> DepGraphData<D> {
750
750
}
751
751
752
752
#[ instrument( skip( self , qcx, parent_dep_node_index, frame) , level = "debug" ) ]
753
- fn try_mark_parent_green < Qcx : QueryContext < Deps = D > > (
753
+ fn try_mark_parent_green < Qcx : QueryContext > (
754
754
& self ,
755
755
qcx : Qcx ,
756
756
parent_dep_node_index : SerializedDepNodeIndex ,
@@ -838,7 +838,7 @@ impl<D: Deps> DepGraphData<D> {
838
838
839
839
/// Try to mark a dep-node which existed in the previous compilation session as green.
840
840
#[ instrument( skip( self , qcx, prev_dep_node_index, frame) , level = "debug" ) ]
841
- fn try_mark_previous_green < Qcx : QueryContext < Deps = D > > (
841
+ fn try_mark_previous_green < Qcx : QueryContext > (
842
842
& self ,
843
843
qcx : Qcx ,
844
844
prev_dep_node_index : SerializedDepNodeIndex ,
@@ -909,7 +909,7 @@ impl<D: Deps> DepGraphData<D> {
909
909
/// This may be called concurrently on multiple threads for the same dep node.
910
910
#[ cold]
911
911
#[ inline( never) ]
912
- fn emit_side_effects < Qcx : QueryContext < Deps = D > > (
912
+ fn emit_side_effects < Qcx : QueryContext > (
913
913
& self ,
914
914
qcx : Qcx ,
915
915
dep_node_index : DepNodeIndex ,
@@ -933,7 +933,7 @@ impl<D: Deps> DepGraphData<D> {
933
933
}
934
934
}
935
935
936
- impl < D : Deps > DepGraph < D > {
936
+ impl DepGraph {
937
937
/// Returns true if the given node has been marked as red during the
938
938
/// current compilation session. Used in various assertions
939
939
pub fn is_red ( & self , dep_node : & DepNode ) -> bool {
@@ -1069,8 +1069,8 @@ rustc_index::newtype_index! {
1069
1069
/// `new_node_to_index` and `data`, or `prev_index_to_index` and `data`. When
1070
1070
/// manipulating both, we acquire `new_node_to_index` or `prev_index_to_index`
1071
1071
/// first, and `data` second.
1072
- pub ( super ) struct CurrentDepGraph < D : Deps > {
1073
- encoder : Steal < GraphEncoder < D > > ,
1072
+ pub ( super ) struct CurrentDepGraph {
1073
+ encoder : Steal < GraphEncoder > ,
1074
1074
new_node_to_index : Sharded < FxHashMap < DepNode , DepNodeIndex > > ,
1075
1075
prev_index_to_index : Lock < IndexVec < SerializedDepNodeIndex , Option < DepNodeIndex > > > ,
1076
1076
@@ -1109,8 +1109,8 @@ pub(super) struct CurrentDepGraph<D: Deps> {
1109
1109
node_intern_event_id : Option < EventId > ,
1110
1110
}
1111
1111
1112
- impl < D : Deps > CurrentDepGraph < D > {
1113
- fn new (
1112
+ impl CurrentDepGraph {
1113
+ fn new < D : Deps > (
1114
1114
profiler : & SelfProfilerRef ,
1115
1115
prev_graph_node_count : usize ,
1116
1116
encoder : FileEncoder ,
@@ -1146,7 +1146,7 @@ impl<D: Deps> CurrentDepGraph<D> {
1146
1146
. map ( EventId :: from_label) ;
1147
1147
1148
1148
CurrentDepGraph {
1149
- encoder : Steal :: new ( GraphEncoder :: new (
1149
+ encoder : Steal :: new ( GraphEncoder :: new :: < D > (
1150
1150
encoder,
1151
1151
prev_graph_node_count,
1152
1152
record_graph,
@@ -1392,7 +1392,7 @@ impl DepNodeColorMap {
1392
1392
1393
1393
#[ inline( never) ]
1394
1394
#[ cold]
1395
- pub ( crate ) fn print_markframe_trace < D : Deps > ( graph : & DepGraph < D > , frame : Option < & MarkFrame < ' _ > > ) {
1395
+ pub ( crate ) fn print_markframe_trace ( graph : & DepGraph , frame : Option < & MarkFrame < ' _ > > ) {
1396
1396
let data = graph. data . as_ref ( ) . unwrap ( ) ;
1397
1397
1398
1398
eprintln ! ( "there was a panic while trying to force a dep node" ) ;
0 commit comments