@@ -22,18 +22,17 @@ use petgraph::prelude::*;
2222use rustc_hash:: { FxHashMap , FxHashSet } ;
2323use std:: mem;
2424use std:: sync:: Arc ;
25- use tokio:: sync:: RwLock ;
2625use tracing:: { debug, instrument, trace} ;
2726
2827macro_rules! insert_node_or_exit {
2928 ( $builder: ident, $node: expr) => { {
3029 let node = $node;
3130
32- match $builder. get_index_from_node( & node) . await {
31+ match $builder. get_index_from_node( & node) {
3332 Some ( index) => {
3433 return Ok ( Some ( index) ) ;
3534 }
36- None => $builder. insert_node( node) . await ,
35+ None => $builder. insert_node( node) ,
3736 }
3837 } } ;
3938}
@@ -79,7 +78,7 @@ pub struct ActionGraphBuilder<'query> {
7978 all_query : Option < Criteria < ' query > > ,
8079 app_context : Arc < AppContext > ,
8180 graph : DiGraph < ActionNode , ( ) > ,
82- nodes : RwLock < FxHashMap < ActionNode , NodeIndex > > ,
81+ nodes : FxHashMap < ActionNode , NodeIndex > ,
8382 options : ActionGraphBuilderOptions ,
8483 platform_manager : Option < PlatformManager > ,
8584 workspace_graph : Arc < WorkspaceGraph > ,
@@ -107,7 +106,7 @@ impl<'query> ActionGraphBuilder<'query> {
107106 all_query : None ,
108107 app_context,
109108 graph : DiGraph :: new ( ) ,
110- nodes : RwLock :: new ( FxHashMap :: default ( ) ) ,
109+ nodes : FxHashMap :: default ( ) ,
111110 options,
112111 passthrough_targets : FxHashSet :: default ( ) ,
113112 platform_manager : None ,
@@ -296,7 +295,7 @@ impl<'query> ActionGraphBuilder<'query> {
296295 } else {
297296 None
298297 }
299- . unwrap_or_else ( || runtime . to_owned ( ) ) ;
298+ . unwrap_or_else ( || self . get_compat_runtime ( runtime ) ) ;
300299
301300 let platform = platform_manager. get_by_toolchain ( & new_runtime. toolchain ) ?;
302301 let packages_root = platform. find_dependency_workspace_root ( project. source . as_str ( ) ) ?;
@@ -834,7 +833,7 @@ impl<'query> ActionGraphBuilder<'query> {
834833 } ) ;
835834
836835 // 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) {
838837 return Ok ( Some ( index) ) ;
839838 }
840839
@@ -852,7 +851,7 @@ impl<'query> ActionGraphBuilder<'query> {
852851 }
853852
854853 // Insert and then link edges
855- let index = self . insert_node ( node) . await ;
854+ let index = self . insert_node ( node) ;
856855
857856 if !task. deps . is_empty ( ) {
858857 child_reqs. skip_affected = true ;
@@ -921,7 +920,7 @@ impl<'query> ActionGraphBuilder<'query> {
921920 let index = insert_node_or_exit ! (
922921 self ,
923922 ActionNode :: setup_toolchain_legacy( SetupToolchainLegacyNode {
924- runtime: runtime . to_owned ( ) ,
923+ runtime: self . get_compat_runtime ( runtime ) ,
925924 } )
926925 ) ;
927926
@@ -1038,8 +1037,16 @@ impl<'query> ActionGraphBuilder<'query> {
10381037
10391038 // PRIVATE
10401039
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 ( )
10431050 }
10441051
10451052 fn link_first_requirement ( & mut self , index : NodeIndex , edges : Vec < Option < NodeIndex > > ) {
@@ -1070,13 +1077,11 @@ impl<'query> ActionGraphBuilder<'query> {
10701077 }
10711078 }
10721079
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 {
10761081 let label = node. label ( ) ;
10771082 let index = self . graph . add_node ( node. clone ( ) ) ;
10781083
1079- nodes. insert ( node, index) ;
1084+ self . nodes . insert ( node, index) ;
10801085
10811086 debug ! (
10821087 index = index. index( ) ,
0 commit comments