@@ -560,7 +560,7 @@ pub async fn main(
560
560
write ! ( process. stdout( ) . lock( ) , "{err}" ) ?;
561
561
info ! ( "This is the version for the rustup toolchain manager, not the rustc compiler." ) ;
562
562
let mut cfg = common:: set_globals ( current_dir, true , process) ?;
563
- match cfg. active_rustc_version ( ) {
563
+ match cfg. active_rustc_version ( ) . await {
564
564
Ok ( Some ( version) ) => info ! ( "The currently active `rustc` version is `{version}`" ) ,
565
565
Ok ( None ) => info ! ( "No `rustc` is currently active" ) ,
566
566
Err ( err) => trace ! ( "Failed to display the current `rustc` version: {err}" ) ,
@@ -601,10 +601,12 @@ pub async fn main(
601
601
match subcmd {
602
602
RustupSubcmd :: DumpTestament => common:: dump_testament ( process) ,
603
603
RustupSubcmd :: Install { opts } => update ( cfg, opts, true ) . await ,
604
- RustupSubcmd :: Uninstall { opts } => toolchain_remove ( cfg, opts) ,
604
+ RustupSubcmd :: Uninstall { opts } => toolchain_remove ( cfg, opts) . await ,
605
605
RustupSubcmd :: Show { verbose, subcmd } => handle_epipe ( match subcmd {
606
- None => show ( cfg, verbose) ,
607
- Some ( ShowSubcmd :: ActiveToolchain { verbose } ) => show_active_toolchain ( cfg, verbose) ,
606
+ None => show ( cfg, verbose) . await ,
607
+ Some ( ShowSubcmd :: ActiveToolchain { verbose } ) => {
608
+ show_active_toolchain ( cfg, verbose) . await
609
+ }
608
610
Some ( ShowSubcmd :: Home ) => show_rustup_home ( cfg) ,
609
611
Some ( ShowSubcmd :: Profile ) => {
610
612
writeln ! ( process. stdout( ) . lock( ) , "{}" , cfg. get_profile( ) ?) ?;
@@ -633,12 +635,12 @@ pub async fn main(
633
635
RustupSubcmd :: Toolchain { subcmd } => match subcmd {
634
636
ToolchainSubcmd :: Install { opts } => update ( cfg, opts, true ) . await ,
635
637
ToolchainSubcmd :: List { verbose, quiet } => {
636
- handle_epipe ( common:: list_toolchains ( cfg, verbose, quiet) )
638
+ handle_epipe ( common:: list_toolchains ( cfg, verbose, quiet) . await )
637
639
}
638
640
ToolchainSubcmd :: Link { toolchain, path } => {
639
641
toolchain_link ( cfg, & toolchain, & path) . await
640
642
}
641
- ToolchainSubcmd :: Uninstall { opts } => toolchain_remove ( cfg, opts) ,
643
+ ToolchainSubcmd :: Uninstall { opts } => toolchain_remove ( cfg, opts) . await ,
642
644
} ,
643
645
RustupSubcmd :: Check => check_updates ( cfg) . await ,
644
646
RustupSubcmd :: Default {
@@ -751,7 +753,7 @@ async fn default_(
751
753
}
752
754
} ;
753
755
754
- if let Some ( ( toolchain, reason) ) = cfg. find_active_toolchain ( ) ? {
756
+ if let Some ( ( toolchain, reason) ) = cfg. find_active_toolchain ( None ) . await ? {
755
757
if !matches ! ( reason, ActiveReason :: Default ) {
756
758
info ! ( "note that the toolchain '{toolchain}' is currently in use ({reason})" ) ;
757
759
}
@@ -928,7 +930,7 @@ async fn which(
928
930
binary : & str ,
929
931
toolchain : Option < ResolvableToolchainName > ,
930
932
) -> Result < utils:: ExitCode > {
931
- let binary_path = cfg. resolve_toolchain ( toolchain) ?. binary_file ( binary) ;
933
+ let binary_path = cfg. resolve_toolchain ( toolchain) . await ?. binary_file ( binary) ;
932
934
933
935
utils:: assert_is_file ( & binary_path) ?;
934
936
@@ -937,7 +939,7 @@ async fn which(
937
939
}
938
940
939
941
#[ tracing:: instrument( level = "trace" , skip_all) ]
940
- fn show ( cfg : & Cfg < ' _ > , verbose : bool ) -> Result < utils:: ExitCode > {
942
+ async fn show ( cfg : & Cfg < ' _ > , verbose : bool ) -> Result < utils:: ExitCode > {
941
943
common:: warn_if_host_is_emulated ( cfg. process ) ;
942
944
943
945
// Print host triple
@@ -962,7 +964,7 @@ fn show(cfg: &Cfg<'_>, verbose: bool) -> Result<utils::ExitCode> {
962
964
let installed_toolchains = cfg. list_toolchains ( ) ?;
963
965
let active_toolchain_and_reason: Option < ( ToolchainName , ActiveReason ) > =
964
966
if let Ok ( Some ( ( LocalToolchainName :: Named ( toolchain_name) , reason) ) ) =
965
- cfg. find_active_toolchain ( )
967
+ cfg. find_active_toolchain ( None ) . await
966
968
{
967
969
Some ( ( toolchain_name, reason) )
968
970
} else {
@@ -1081,8 +1083,8 @@ fn show(cfg: &Cfg<'_>, verbose: bool) -> Result<utils::ExitCode> {
1081
1083
}
1082
1084
1083
1085
#[ tracing:: instrument( level = "trace" , skip_all) ]
1084
- fn show_active_toolchain ( cfg : & Cfg < ' _ > , verbose : bool ) -> Result < utils:: ExitCode > {
1085
- match cfg. find_active_toolchain ( ) ? {
1086
+ async fn show_active_toolchain ( cfg : & Cfg < ' _ > , verbose : bool ) -> Result < utils:: ExitCode > {
1087
+ match cfg. find_active_toolchain ( None ) . await ? {
1086
1088
Some ( ( toolchain_name, reason) ) => {
1087
1089
let toolchain = Toolchain :: with_reason ( cfg, toolchain_name. clone ( ) , & reason) ?;
1088
1090
writeln ! (
@@ -1118,7 +1120,7 @@ async fn target_list(
1118
1120
quiet : bool ,
1119
1121
) -> Result < utils:: ExitCode > {
1120
1122
// downcasting required because the toolchain files can name any toolchain
1121
- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) ?;
1123
+ let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1122
1124
common:: list_items (
1123
1125
distributable,
1124
1126
|c| {
@@ -1145,7 +1147,7 @@ async fn target_add(
1145
1147
// isn't a feature yet.
1146
1148
// list_components *and* add_component would both be inappropriate for
1147
1149
// custom toolchains.
1148
- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) ?;
1150
+ let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1149
1151
let components = distributable. components ( ) ?;
1150
1152
1151
1153
if targets. contains ( & "all" . to_string ( ) ) {
@@ -1189,7 +1191,7 @@ async fn target_remove(
1189
1191
targets : Vec < String > ,
1190
1192
toolchain : Option < PartialToolchainDesc > ,
1191
1193
) -> Result < utils:: ExitCode > {
1192
- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) ?;
1194
+ let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1193
1195
1194
1196
for target in targets {
1195
1197
let target = TargetTriple :: new ( target) ;
@@ -1227,7 +1229,7 @@ async fn component_list(
1227
1229
quiet : bool ,
1228
1230
) -> Result < utils:: ExitCode > {
1229
1231
// downcasting required because the toolchain files can name any toolchain
1230
- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) ?;
1232
+ let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1231
1233
common:: list_items (
1232
1234
distributable,
1233
1235
|c| Some ( & c. name ) ,
@@ -1243,7 +1245,7 @@ async fn component_add(
1243
1245
toolchain : Option < PartialToolchainDesc > ,
1244
1246
target : Option < String > ,
1245
1247
) -> Result < utils:: ExitCode > {
1246
- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) ?;
1248
+ let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1247
1249
let target = get_target ( target, & distributable) ;
1248
1250
1249
1251
for component in & components {
@@ -1269,7 +1271,7 @@ async fn component_remove(
1269
1271
toolchain : Option < PartialToolchainDesc > ,
1270
1272
target : Option < String > ,
1271
1273
) -> Result < utils:: ExitCode > {
1272
- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) ?;
1274
+ let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1273
1275
let target = get_target ( target, & distributable) ;
1274
1276
1275
1277
for component in & components {
@@ -1311,9 +1313,14 @@ async fn toolchain_link(
1311
1313
Ok ( utils:: ExitCode ( 0 ) )
1312
1314
}
1313
1315
1314
- fn toolchain_remove ( cfg : & mut Cfg < ' _ > , opts : UninstallOpts ) -> Result < utils:: ExitCode > {
1316
+ async fn toolchain_remove ( cfg : & mut Cfg < ' _ > , opts : UninstallOpts ) -> Result < utils:: ExitCode > {
1315
1317
let default_toolchain = cfg. get_default ( ) . ok ( ) . flatten ( ) ;
1316
- let active_toolchain = cfg. find_active_toolchain ( ) . ok ( ) . flatten ( ) . map ( |( it, _) | it) ;
1318
+ let active_toolchain = cfg
1319
+ . find_active_toolchain ( Some ( false ) )
1320
+ . await
1321
+ . ok ( )
1322
+ . flatten ( )
1323
+ . map ( |( it, _) | it) ;
1317
1324
1318
1325
for toolchain_name in & opts. toolchain {
1319
1326
let toolchain_name = toolchain_name. resolve ( & cfg. get_default_host_triple ( ) ?) ?;
@@ -1556,7 +1563,7 @@ async fn doc(
1556
1563
mut topic : Option < & str > ,
1557
1564
doc_page : & DocPage ,
1558
1565
) -> Result < utils:: ExitCode > {
1559
- let toolchain = cfg. toolchain_from_partial ( toolchain) ?;
1566
+ let toolchain = cfg. toolchain_from_partial ( toolchain) . await ?;
1560
1567
1561
1568
if let Ok ( distributable) = DistributableToolchain :: try_from ( & toolchain) {
1562
1569
if let [ _] = distributable
@@ -1625,7 +1632,7 @@ async fn man(
1625
1632
command : & str ,
1626
1633
toolchain : Option < PartialToolchainDesc > ,
1627
1634
) -> Result < utils:: ExitCode > {
1628
- let toolchain = cfg. toolchain_from_partial ( toolchain) ?;
1635
+ let toolchain = cfg. toolchain_from_partial ( toolchain) . await ?;
1629
1636
let path = toolchain. man_path ( ) ;
1630
1637
utils:: assert_is_directory ( & path) ?;
1631
1638
0 commit comments