@@ -22,18 +22,17 @@ use petgraph::prelude::*;
22
22
use rustc_hash:: { FxHashMap , FxHashSet } ;
23
23
use std:: mem;
24
24
use std:: sync:: Arc ;
25
- use tokio:: sync:: RwLock ;
26
25
use tracing:: { debug, instrument, trace} ;
27
26
28
27
macro_rules! insert_node_or_exit {
29
28
( $builder: ident, $node: expr) => { {
30
29
let node = $node;
31
30
32
- match $builder. get_index_from_node( & node) . await {
31
+ match $builder. get_index_from_node( & node) {
33
32
Some ( index) => {
34
33
return Ok ( Some ( index) ) ;
35
34
}
36
- None => $builder. insert_node( node) . await ,
35
+ None => $builder. insert_node( node) ,
37
36
}
38
37
} } ;
39
38
}
@@ -79,7 +78,7 @@ pub struct ActionGraphBuilder<'query> {
79
78
all_query : Option < Criteria < ' query > > ,
80
79
app_context : Arc < AppContext > ,
81
80
graph : DiGraph < ActionNode , ( ) > ,
82
- nodes : RwLock < FxHashMap < ActionNode , NodeIndex > > ,
81
+ nodes : FxHashMap < ActionNode , NodeIndex > ,
83
82
options : ActionGraphBuilderOptions ,
84
83
platform_manager : Option < PlatformManager > ,
85
84
workspace_graph : Arc < WorkspaceGraph > ,
@@ -107,7 +106,7 @@ impl<'query> ActionGraphBuilder<'query> {
107
106
all_query : None ,
108
107
app_context,
109
108
graph : DiGraph :: new ( ) ,
110
- nodes : RwLock :: new ( FxHashMap :: default ( ) ) ,
109
+ nodes : FxHashMap :: default ( ) ,
111
110
options,
112
111
passthrough_targets : FxHashSet :: default ( ) ,
113
112
platform_manager : None ,
@@ -296,7 +295,7 @@ impl<'query> ActionGraphBuilder<'query> {
296
295
} else {
297
296
None
298
297
}
299
- . unwrap_or_else ( || runtime . to_owned ( ) ) ;
298
+ . unwrap_or_else ( || self . get_compat_runtime ( runtime ) ) ;
300
299
301
300
let platform = platform_manager. get_by_toolchain ( & new_runtime. toolchain ) ?;
302
301
let packages_root = platform. find_dependency_workspace_root ( project. source . as_str ( ) ) ?;
@@ -834,7 +833,7 @@ impl<'query> ActionGraphBuilder<'query> {
834
833
} ) ;
835
834
836
835
// Check if the node exists to avoid all the overhead below
837
- if let Some ( index) = self . get_index_from_node ( & node) . await {
836
+ if let Some ( index) = self . get_index_from_node ( & node) {
838
837
return Ok ( Some ( index) ) ;
839
838
}
840
839
@@ -852,7 +851,7 @@ impl<'query> ActionGraphBuilder<'query> {
852
851
}
853
852
854
853
// Insert and then link edges
855
- let index = self . insert_node ( node) . await ;
854
+ let index = self . insert_node ( node) ;
856
855
857
856
if !task. deps . is_empty ( ) {
858
857
child_reqs. skip_affected = true ;
@@ -921,7 +920,7 @@ impl<'query> ActionGraphBuilder<'query> {
921
920
let index = insert_node_or_exit ! (
922
921
self ,
923
922
ActionNode :: setup_toolchain_legacy( SetupToolchainLegacyNode {
924
- runtime: runtime . to_owned ( ) ,
923
+ runtime: self . get_compat_runtime ( runtime ) ,
925
924
} )
926
925
) ;
927
926
@@ -1038,8 +1037,16 @@ impl<'query> ActionGraphBuilder<'query> {
1038
1037
1039
1038
// PRIVATE
1040
1039
1041
- async fn get_index_from_node ( & self , node : & ActionNode ) -> Option < NodeIndex > {
1042
- self . nodes . read ( ) . await . get ( node) . cloned ( )
1040
+ fn get_compat_runtime ( & self , runtime : & Runtime ) -> Runtime {
1041
+ let mut next = runtime. to_owned ( ) ;
1042
+ // Disable this, so that the index for both override and not-override
1043
+ // is the same, as we only care about the toolchain ID + version
1044
+ next. overridden = false ;
1045
+ next
1046
+ }
1047
+
1048
+ fn get_index_from_node ( & self , node : & ActionNode ) -> Option < NodeIndex > {
1049
+ self . nodes . get ( node) . cloned ( )
1043
1050
}
1044
1051
1045
1052
fn link_first_requirement ( & mut self , index : NodeIndex , edges : Vec < Option < NodeIndex > > ) {
@@ -1070,13 +1077,11 @@ impl<'query> ActionGraphBuilder<'query> {
1070
1077
}
1071
1078
}
1072
1079
1073
- async fn insert_node ( & mut self , node : ActionNode ) -> NodeIndex {
1074
- let mut nodes = self . nodes . write ( ) . await ;
1075
-
1080
+ fn insert_node ( & mut self , node : ActionNode ) -> NodeIndex {
1076
1081
let label = node. label ( ) ;
1077
1082
let index = self . graph . add_node ( node. clone ( ) ) ;
1078
1083
1079
- nodes. insert ( node, index) ;
1084
+ self . nodes . insert ( node, index) ;
1080
1085
1081
1086
debug ! (
1082
1087
index = index. index( ) ,
0 commit comments